PPTX - gozips.uakron.edu

Download Report

Transcript PPTX - gozips.uakron.edu

ECE 4450:427/527 - Computer Networks
Spring 2017
Dr. Nghi Tran
Department of Electrical & Computer Engineering
Lecture 6.2: IP
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
1
Internetworking: Discussions
• For Internetworking, we shall look at few subproblems:
• Interconnect links of the same type: Switches
• We consider an important of class switch: Bridges
to interconnect Ethernet segments.
• We also look a way to interconnect disparate
networks and links: Gateways, or now mostly
known as routers. We shall focus on the IP
• Once we are able to interconnect a whole lot of
links and networks with switches and routers, we
will look at a way to find a suitable path, or route
through a new working:
• Paths that are efficient, loop free, etc.: Routing
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
2
Internetworking
• What is internetwork
– An arbitrary collection of networks interconnected to provide some
sort of host-host to packet delivery service
A simple internetwork where H represents hosts and R represents routers
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
3
IP: Internet Protocol
• What is IP
– IP stands for Internet Protocol
– Key tool used today to build scalable, heterogeneous internetworks
– It runs on all the nodes in a collection of networks and defines the
infrastructure that allows these nodes and networks to function as a
single logical internetwork
A simple internetwork showing the protocol layers
A simple internetwork showing the protocol layers
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
4
IP: “Best Effort” Service
•IP is a datagram connectionless protocol
•Does not provide any type of guarantee about
packet delivery
–Out of order packet deliveries, duplicate packets, no error
correction
•If packets are lost, IP does not try to recover or
retransmit (though lower or higher layer
functionalities may do so)
•Global addressing scheme
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
5
IPv4: Packet Format
4-bit
Version
4-bit
Header
Length
8-bit
Type of Service
(TOS)
3-bit
Flags
16-bit Identification
8-bit Time to
Live (TTL)
16-bit Total Length (Bytes)
8-bit Protocol
13-bit Fragment Offset
16-bit Header Checksum
32-bit Source IP Address
32-bit Destination IP Address
Options (if any)
Payload
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
6
IP Packet Format
Version number (4 bits)
Indicates the version of the IP protocol
Necessary to know what other fields to expect
Typically “4” (for IPv4), and sometimes “6” (for IPv6)
Header length (4 bits)
Number of 32-bit words in the header
Typically “5” (for a 20-byte IPv4 header)
Can be more when “IP options” are used
Type-of-Service (8 bits)
Allow packets to be treated differently based on needs
E.g., low delay for audio, high bandwidth for bulk transfer
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
7
IP Packet Format
Total length (16 bits)
Number of bytes in the packet
Maximum size is 63,535 bytes (216 -1)
… though underlying links may impose harder limits
Fragmentation information (32 bits)
Packet identifier, flags, and fragment offset
Supports dividing a large IP packet into fragments
… in case a link cannot handle a large IP packet
Time-To-Live (8 bits)
Used to identify packets stuck in forwarding loops
… and eventually discard them from the network
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
8
Time-to-Live (TTL)
Potential robustness problem
Forwarding loops can cause packets to cycle forever
Confusing if the packet arrives much later
Time-to-live field in packet header
TTL field decremented by each router on the path
Packet is discarded when TTL field reaches 0…
…and “time exceeded” message is sent to the source
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
9
Protocol Field
Protocol (8 bits)
Identifies the higher-level protocol
E.g., “6” for the Transmission Control Protocol (TCP)
E.g., “17” for the User Datagram Protocol (UDP)
Important for demultiplexing at receiving host
Indicates what kind of header to expect next
protocol=6
protocol=17
IP header
IP header
TCP header
UDP header
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
10
IP Addresses Field
Two IP addresses
Source IP address (32 bits)
Destination IP address (32 bits)
Destination address
Unique identifier for the receiving host
Allows each node/router to make forwarding decisions
Source address
Unique identifier for the sending host
Recipient can decide whether to accept packet
Enables recipient to send a reply back to source
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
11
IP Fragmentation and Reassembly
• Each network has some MTU (Maximum
Transmission Unit): largest IP datagram it can carry in
a frame
– Ethernet (1500 bytes), FDDI (4500 bytes)
• Strategy
– Fragmentation occurs in a router when it receives a
datagram that it wants to forward over a network which
has (MTU < received datagram)
– Reassembly is done at the receiving host
– All the fragments carry the same identifier in the Ident field
– Fragments are self-contained datagrams
– IP does not recover from missing fragments
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
12
IP Fragmentation and Reassembly
IP datagrams traversing the sequence of physical networks
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
13
IP Fragmentation and Reassembly
Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets.
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
14
IP Datagram Forwarding
• Strategy
– every datagram contains destination's address
– if directly connected to destination network, then forward to host
– if not directly connected to destination network, then forward to some
router
– forwarding table maps network number into next hop
– each host has a default router
– each router maintains a forwarding table
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
15
Forwarding Table
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
16
IPv4 Addressing
A unique 32-bit number
Identifies an interface (on a host, on a router, …)
Represented in dotted-quad notation
12
34
158
5
00001100 00100010 10011110 00000101
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
17
IPv4 Addressing
• A host usually has a single link into network: When IP in host
wants to send datagram, it does so over the link -> Boundary
between host and link: interface.
• IP address: technically associated with an interface, rather
with the host
• How about a router?
• Receive datagram on a link and forward to on some other link.
• How many interfaces? How many IP addresses?
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
18
IPv4: Early Addressing
• Properties
– globally unique
– hierarchical: network + host
– 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C type
• Format
• Dot notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
19
IP Addressing: CIDR
CIDR: Classless InterDomain Routing
– subnet portion of address of arbitrary length
– address format: a.b.c.d/x, where x is # bits in
subnet portion of address
host
part
subnet
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
20
Subnets
• IP address:
223.1.1.1
– subnet part (high order
bits)
– host part (low order bits)
223.1.2.1
223.1.1.2
223.1.1.4
• What’s a subnet ?
223.1.1.3
– device interfaces with
same subnet part of IP
address
– can physically reach each
other without intervening
router
Dr. Nghi Tran (ECE-University of Akron)
223.1.2.9
223.1.3.27
223.1.2.2
subnet
223.1.3.1
223.1.3.2
network consisting of 3 subnets
ECE 4450:427/527
Computer Networks
21
Subnet and Subnet Mask
223.1.1.0/24
Recipe
• to determine the subnets,
detach each interface
from its host or router,
creating islands of isolated
networks
• each isolated network is
called a subnet.
223.1.2.0/24
223.1.3.0/24
Subnet mask: /24
Or 255.255.255.000
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
22
Subnets
223.1.1.2
223.1.1.1
How many?
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.2.6
223.1.2.1
Dr. Nghi Tran (ECE-University of Akron)
223.1.3.27
223.1.2.2
ECE 4450:427/527
223.1.3.1
223.1.3.2
Computer Networks
23
ARP: Address Resolution Protocol
Question: how to determine
MAC address of B
knowing B’s IP address?
137.196.7.78
1A-2F-BB-76-09-AD
137.196.7.23
• Each IP node (host, router)
on LAN has ARP table in
ARP module
• ARP table: IP/MAC address
mappings for some LAN
nodes
137.196.7.14
< IP address; MAC address; TTL>
–
LAN
71-65-F7-2B-08-53
137.196.7.88
Dr. Nghi Tran (ECE-University of Akron)
58-23-D7-FA-20-B0
TTL (Time To Live): time after
which address mapping will
be forgotten (typically 20
min)
0C-C4-11-6F-E3-98
ECE 4450:427/527
Computer Networks
24
ARP: Same LAN
• A wants to send datagram to B,
and B’s MAC address not in A’s
ARP table.
• A broadcasts ARP query packet,
containing B's IP address
– dest MAC address = FF-FFFF-FF-FF-FF
– all machines on LAN
receive ARP query
• B receives ARP packet, replies
to A with its (B's) MAC address
• A caches (saves) IP-to-MAC
address pair in its ARP table
until information becomes old
(times out)
• ARP is “plug-and-play”:
– nodes create their ARP
tables without intervention
from net administrator
– frame sent to A’s MAC address
(unicast)
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
25
ARP: Packet Format
–
–
–
–
–
HardwareType: type of physical network (e.g., Ethernet)
ProtocolType: type of higher layer protocol (e.g., IP)
HLEN & PLEN: length of physical and protocol addresses
Operation: request or response
Source/Target Physical/Protocol addresses
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
26
Addressing: Routing to another LAN
walkthrough: send datagram from A to B via R.
–focus on addressing - at both IP (datagram) and MAC layer (frame)
–assume A knows B’s IP address
–How can A know whether B is in the same subnet/network?
–assume A knows B’s MAC address (how?)
–assume A knows IP address of first hop router, R (how?)
–assume A knows MAC address of first hop router interface (how?) – How
many MAC addresses?
A
R
111.111.111.111
74-29-9C-E8-FF-55
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
111.111.111.110
E6-E9-00-17-BB-4B
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
27
Addressing: Routing to another LAN
A creates IP datagram with IP source A, destination B
A creates link-layer frame with R's MAC address as dest, frame
contains A-to-B IP datagram


MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A
R
111.111.111.111
74-29-9C-E8-FF-55
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
Dr. Nghi Tran (ECE-University of Akron)
111.111.111.110
E6-E9-00-17-BB-4B
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
28
Addressing: Routing to another LAN
frame sent from A to R
frame received at R, datagram removed, passed up to IP


MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
IP
Eth
Phy
A
R
111.111.111.111
74-29-9C-E8-FF-55
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
111.111.111.110
E6-E9-00-17-BB-4B
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
29
Addressing: Routing to another LAN


R forwards datagram with IP source A, destination B
R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A
R
111.111.111.111
74-29-9C-E8-FF-55
IP
Eth
Phy
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
Dr. Nghi Tran (ECE-University of Akron)
111.111.111.110
E6-E9-00-17-BB-4B
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
30
Addressing: Routing to another LAN


R forwards datagram with IP source A, destination B
R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A
R
111.111.111.111
74-29-9C-E8-FF-55
IP
Eth
Phy
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
Dr. Nghi Tran (ECE-University of Akron)
111.111.111.110
E6-E9-00-17-BB-4B
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
31
Addressing: Routing to another LAN


R forwards datagram with IP source A, destination B
R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A
R
111.111.111.111
74-29-9C-E8-FF-55
B
222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112
CC-49-DE-D0-AB-7D
Dr. Nghi Tran (ECE-University of Akron)
111.111.111.110
E6-E9-00-17-BB-4B
ECE 4450:427/527
222.222.222.221
88-B2-2F-54-1A-0F
Computer Networks
32
IP Addresses: How to get one?
– MAC address: configured in adapter, globally unique
– IP address:
• Not only be unique on a given internetwork, but needs to
reflect the structure of the internetwork
• Not possible to be configured once into host; Hosts might
change to another network: IP needs to be reconfigurable
– Usually, automatic configuration methods are
required: Dynamic Host Configuration Protocol
(DHCP): Textbook, 3.2.7
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
33
A day in the life: Connecting to Internet
DNS server
browser
Comcast network
68.80.0.0/13
school network
68.80.2.0/24
web page
Google’s network
64.233.160.0/19
web server
64.233.169.105
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
34
A day in the life: Connecting to Internet
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
• connecting laptop needs to get
its own IP address, addr of
first-hop router, addr of DNS
server: use DHCP
DHCP

DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
router
(runs DHCP)


Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
DHCP request encapsulated
in UDP, encapsulated in IP,
encapsulated in 802.1
Ethernet
Ethernet frame broadcast
(dest: FFFFFFFFFFFF) on LAN,
received at router running
DHCP server
Ethernet demuxed to IP
demuxed, UDP demuxed to
DHCP
Computer Networks
35
A day in the life: Connecting to Internet
•
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP

DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
router
(runs DHCP)

DHCP server formulates DHCP
ACK containing client’s IP
address, IP address of first-hop
router for client, name & IP
address of DNS server
encapsulation at DHCP
server, frame forwarded
(switch learning) through
LAN, demultiplexing at
client
DHCP client receives DHCP
ACK reply
Client now has IP address, knows name & addr of DNS
server, IP address of its first-hop router
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
36
A day in the life: ARP (before DNS, HTTP)
DNS
DNS
DNS
ARP query
• before sending HTTP request, need IP
address of www.google.com: DNS
DNS
UDP
IP
ARP
Eth
Phy

ARP
ARP reply
Eth
Phy


Dr. Nghi Tran (ECE-University of Akron)
DNS query created, encapsulated
in UDP, encapsulated in IP,
encapsulated in Eth. In order to
send frame to router, need MAC
address of router interface: ARP
ARP query broadcast, received
by router, which replies with
ARP reply giving MAC address
of router interface
client now knows MAC address
of first hop router, so can now
send frame containing DNS
query
ECE 4450:427/527
Computer Networks
37
NAT
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.1
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local
network have same single source NAT IP
address: 138.76.29.7,
different source port numbers
Dr. Nghi Tran (ECE-University of Akron)
Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
ECE 4450:427/527
Computer Networks
38
NAT
Implementation: NAT router must:
– outgoing datagrams: replace (source IP address,
port #) of every outgoing datagram to (NAT IP
address, new port #)
. . . remote clients/servers will respond using (NAT IP
address, new port #) as destination addr.
– remember (in NAT translation table) every (source IP
address, port #) to (NAT IP address, new port #)
translation pair
– incoming datagrams: replace (NAT IP address, new
port #) in dest fields of every incoming datagram
with corresponding (source IP address, port #)
stored in NAT table
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
39
NAT
NAT translation table
WAN side addr
LAN side addr
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
1: host 10.0.0.1
sends datagram to
128.119.40.186, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
2
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.7
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3: Reply arrives
dest. address:
138.76.29.7, 5001
Dr. Nghi Tran (ECE-University of Akron)
3
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
10.0.0.2
4
10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
ECE 4450:427/527
Computer Networks
40
NAT: Network Address Translation
• NAT is controversial:
– routers should only process up to layer 3
– violates end-to-end argument: Hosts should be
talking directly with each other, without
interfereing nodes modifying IP addresses and
port numbers
– Address shortage should instead be solved by
IPv6
But like it or not, NAT becomes an important
component of the Internet
Dr. Nghi Tran (ECE-University of Akron)
ECE 4450:427/527
Computer Networks
41