Internetworking

Download Report

Transcript Internetworking

Internetworking:
IP Packet Switching
Reading: 4.1.1 - 4.1.7
(except Implementation; pp. 245-250 )
1
Terminology
• “internetwork”, internet: an arbitrary collection of
physical networks interconnected to provide
some sort of host- to-host packet delivery
service
– interconnect physical networks (e.g. Ethernets,
FDDIs, ATMs, PPP,..)
• form a logical network (an internet)
• Internet: widely used, global internetwork to
which a large percentage of networks are now
connected
• Learn the principles of internetworking
– illustrate ideas with real-world examples from Internet
2
Network of “Single Technology Networks”
• Internet Protocol, IP: a tool used to build
scalable, heterogeneous internetwork
–
–
–
–
net 1, net 2 : Ethernets
net 3: FDDI
net 4: point-to-point link
R1, R2, R3: routers for
interconnection
H1
H2
H7
H3
R3
H8
Netw ork 4
(point-to-point)
Netw ork 2 (Ethernet)
R1
R2
H4
Netw ork 3 (FDDI)
H6
H5
H1
H8
TCP
R1
IP
ETH
Netw ork 1 (Ethernet)
R2
IP
ETH
R3
IP
FDDI
FDDI
IP
PPP
PPP
TCP
IP
ETH
ETH
3
Service Model
• Connectionless (datagram-based)
• Best-effort delivery (unreliable service to transport
{or other higher} layer protocols)
–
–
–
–
packets are lost
packets are delivered out of order
duplicate copies of a packet are delivered
packets can be delayed for a long time
4
Packet Format: 20 to 24 byte Header I
1. Version
2. HLen: length of header in 32-bit words
3. TOS, Type of Service: allow packets to be treated
differently based on application needs
4. Length: bytes of datagram (including header, max
65,535)
5. Indent, Offset , Flag: information used for fragmentation
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Pad
(variable)
Data
5
Packet Format: 20 to 24 byte Header II
6. TTL, time to live: discard looping packets; 64 is the
current default
7. Protocol: higher-level protocol (TCP = 6, UDP =17, …)
8. Checksum: calculated for IP header considered as a
sequence of 16-bit words
9. SourceAddr, DestinationAddr: IP defines its own global
address space, independent of physical networks
10. Options, Pad: rarely use
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Pad
(variable)
Data
6
Fragmentation and Reassembly
• Each physical network has some maximum
transmission unit (MTU).
– Examples
•
•
Ethernet packets up to 1500 bytes
FDDI packets up to 4500 bytes
Fragmentation and Reassembly Design Decisions:
1. try to avoid fragmentation at source host
– source host chooses size of IP datagram equals to MTU of
physical network to which it is directly attached
– if transport protocol gives IP a packet larger than local MTU, then
source host fragments it
2. fragment when necessary
– whenever the path to destination includes a network with MTU <
Datagram
7
Design Decisions (cont.)
3. re-fragmentation is possible
– a router wants to forward a datagram over a network
with MTU < received datagram
4. fragments are self-contained datagrams
5. delay reassembly until destination host
– fragments carry same identifier in Ident
• Ident chosen by sending host
• unique among datagrams that might arrive at destination
from source over some reasonable time period
6. do not recover from lost fragments
– If all fragments do not arrive at receiving host, it
discards fragments that arrived
8
Example
Netw ork 1 (Ethernet)
•IP on H1 wants to send to
H8 a 1420-byte packet
(20-byte IP header plus
1400 bytes of data)
•MTU of net2 = 1500 byte
•MTU of net3 = 4500 byte
•MTU of net4 = 532 byte
•MTU of net4 = 1500 byte
H1
H7
H3
R3
H8
Netw ork 4
(point-to-point)
Netw ork 2 (Ethernet)
R1
R2
H4
H1
ETH IP (1400)
R2 must fragment the
packet before routing
it to RT3
H2
1500 MTU
Netw ork 3 (FDDI)
H6
H5
R1
R2
R3
R1
R2
R3
H8
FDDI IP (1400)
PPP IP (512)
ETH IP (512)
4500 MTU
PPP IP (512)
ETH IP (512)
PPP IP (376)
ETH IP (376)
532 MTU
9
Example (continued)
Start of header
Ident = x
First fragment
•M bit 1 in the Flags field (more fragments to follow)
•Offset 0 (fragment contains first part of original datagram)
Second fragment
• starts with the 513th byte
•Offset field in header set to 64, which is 512/8
•fragmentation is done on 8-byte boundaries
1420-byte datagram
(20-byte IP header •Offset field counts 8-byte chunks
0 Offset = 0
Rest of header
(a)
1400 data bytes
Start of header
Ident = x
Rest of header
512 data bytes
(b)
(a) plus 1400 bytes of
data)
1 Offset = 0
Start of header
Ident = x
1 Offset = 64
Rest of header
H1
R1
R2
R3
R1
R2
R3
512 data bytes
H8
(b)
Start of header
Ident = x
ETH IP (1400)
1500 MTU
FDDI IP (1400)
4500 MTU
PPP IP (512)
ETH IP (512)
PPP IP (512)
ETH IP (512)
PPP IP (376)
ETH IP (376)
532 MTU
0 Offset = 128
Rest of header
376 data bytes
Third fragment
•contains last 376 bytes
•offset (2 x 512)/ 8 = 128
10
•M bit is 0
Global Addresses
• Although globally unique, Ethernet addresses
have no structure to provide clues to routing
protocols
• IP addresses: 32 bits
– globally unique (4,294,967,296 possible addresses)
– hierarchical: network + host
7
(a)
0
Netw ork
• Dot Notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
24
Host
14
(b)
1
0
16
Netw ork
Host
21
(c)
1
1
0
Netw ork
8
Host
11
IP addresses (cont. I)
•
The original idea was that the Internet would
consist of
a) a small number of wide area networks (these would
be class A networks), 126
7
(a)
0
Netw ork
24
Host
1. 126 class A networks (the values 0
14
16
and 127 are reserved)
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.\
(b)
1 0 Yes. Netw
Yes. Yes.
Yes.orkYes. Yes. Host
Yes.
2. each class A network accommodate Yes. Yes. Yes. Yes. Yes. Yes. Yes.
21
8
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.
up to 224 - 2 (about 16 million) hosts Yes.
(c)
1 1 Yes.
0
orkYes. Yes.
Host
Yes. Yes.
Yes.Netw
Yes.
(again, there are two reserved
values)
12
IP addresses (cont. II)
•
The original idea was that the Internet would
consist of
a) a small number of wide area networks (these would
be class A networks), 126
b) a modest number of site- (campus-) sized networks
(these would be class B networks)
•
65,534 hosts /network
7
(a)
0
24
Netw ork
Host
14
(b)
1
0
Netw ork
16
Host
21
8
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.\
(c)
1 1 Yes.
0
orkYes. Yes.
Host
Yes. Yes.
Yes.Netw
Yes.
13
IP addresses (cont. III)
•
The original idea was that the Internet would
consist of
a) a small number of wide area networks (these would
be class A networks), 126
b) a modest number of site- (campus-) sized networks
(these would be class B networks)
•
65,534 hosts /network
c) a large number of LANs
7
(a)
(these would be class C networks)
(b)
• 254 hosts/LAN
• 255 reserved for broadcast
• 0 not a valid host number (c)
0
24
Netw ork
Host
14
1
0
16
Netw ork
Host
21
1
1
0
Netw ork
8
Host
14
Datagram Forwarding Strategy
• every datagram contains destination’s address
• if router is connected to destination network, then
forward to host
• if not directly connected, then forward to some
router
• forwarding table maps network number into next
hop (router)
• each host has a default router
• each router maintains a forwarding table
15
Datagram Forwarding (cont.)
Netw ork 1 (Ethernet)
H1
H2
H7
H3
R3
H8
Netw ork 4
(point-to-point)
Netw ork 2 (Ethernet)
R1
R2
H4
Netw ork 3 (FDDI)
H5
• Example: R2 Table
H6
Network Number
1
2
3
4
Next Hop
R3
R1
interface 1
interface 0
16
Address Translation
a packet reaches a new physical network
• map IP address into a physical address
– Either
• determine physical address of destination host
– OR
• determine physical address of next hop router
• encapsulate IP datagram inside a frame that
contains link-level address
17
Address Resolution Protocol (ARP)
•
ARP enables each host on a physical network to
dynamically build up a table of mappings
between IP addresses and link-level addresses
Invoking ARP:
• an “originator” host wants to send a datagram to
a host (or router) on the same physical network
• if no mapping is found in its ARP table, it invokes
the Address Resolution Protocol
18
Executing ARP
1. “originator” host broadcast an ARP query containing
“target IP address” and {IP address; link-layer address}
of originator host
2. if a host on network already has an entry for originator
host, it “refreshes” this entry (resets length of time until it
discards entry)
3. target host adds information about originator to its table
& sends back a response message that contains its linklayer address
4. originator adds information contained in the response to
its ARP table
5. all other hosts do not add an entry for the originator host
19
ARP: Notes
• mappings may change over time
• entries are timed out periodically and removed
– discarded if not refreshed (in about 10 minutes)
20
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
21
ARP Packet Format
0
8
16
Hardware type = 1
HLen = 48
PLen = 32
31
ProtocolType = 0x0800
Operation
SourceHardwareAddr (bytes 0― 3)
SourceHardwareAddr (bytes ―
4 5)
SourceProtocolAddr (bytes ―
0 1)
SourceProtocolAddr (bytes 2― 3)
TargetHardwareAddr (bytes ―
0 1)
TargetHardwareAddr (bytes ―
2 5)
TargetProtocolAddr (bytes 0― 3)
Mapping IP into Ethernet Addresses
22
Internet Control Message Protocol (ICMP)
• a companion protocol to IP
• defines a collection of error messages that are
sent back to source host whenever a router or
host is unable to process an IP datagram
successfully
23
Error Messages Defined by ICMP
• Destination unreachable
• TTL exceeded (so datagrams don’t cycle
forever)
• Checksum failed
• Reassembly failed
• Cannot fragment
• Echo (ping)
• Redirect (one of the control messages a router
can send back to a source host)
– there is a better route to the destination
24