Internetworking: IP Packet Switching

24
1 Internetworking: IP Packet Switching Reading: 4.1.1 - 4.1.7 (except Implementation; pp. 245- 250 )

description

Internetworking: IP Packet Switching. Reading: 4.1.1 - 4.1.7 (except Implementation; pp. 245-250 ) . Terminology. “ i nternetwork”, i nternet: an arbitrary collection of physical networks interconnected to provide some sort of host- to-host packet delivery service - PowerPoint PPT Presentation

Transcript of Internetworking: IP Packet Switching

Page 1: Internetworking: IP Packet Switching

1

Internetworking: IP Packet Switching

Reading: 4.1.1 - 4.1.7(except Implementation; pp. 245-250 )

Page 2: Internetworking: IP Packet Switching

2

Terminology

• “iinternetwork”, iinternet: 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)

• IInternet: 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

Page 3: Internetworking: IP Packet Switching

3

Network of “Single Technology Networks”

• Internet Protocol, IP: a tool used to buildscalable, heterogeneous internetwork– net 1, net 2 : Ethernets– net 3: FDDI– net 4: point-to-point link– R1, R2, R3: routers for

interconnection

R2

R1

H4

H5

H3H2H1

Network 2 (Ethernet)

Network 1 (Ethernet)

H6

Network 4(point-to-point)

H7 R3 H8

Network 3 (FDDI)

R1 R2 R3

H1 H8

ETH FDDI

IP

ETH

TCP

FDDI PPP PPP ETH

IP

ETH

TCP

IP IP IP

Page 4: Internetworking: IP Packet Switching

4

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

Page 5: Internetworking: IP Packet Switching

5

Packet Format: 20 to 24 byte Header I

1. Version2. HLen: length of header in 32-bit words3. TOS, Type of Service: allow packets to be treated

differently based on application needs4. Length: bytes of datagram (including header, max

65,535)5. Indent, Offset , Flag: information used for fragmentation

Version HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable) Pad(variable)

0 4 8 16 19 31

Data

Page 6: Internetworking: IP Packet Switching

6

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 words9. SourceAddr, DestinationAddr: IP defines its own global

address space, independent of physical networks10. Options, Pad: rarely use Version HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable) Pad(variable)

0 4 8 16 19 31

Data

Page 7: Internetworking: IP Packet Switching

7

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

Page 8: Internetworking: IP Packet Switching

8

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 datagrams5. 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

Page 9: Internetworking: IP Packet Switching

9

Example

R2

R1

H4

H5

H3H2H1

Network 2 (Ethernet)

Network 1 (Ethernet)

H6

Network 4(point-to-point)

H7 R3 H8

Network 3 (FDDI)

H1 R1 R2 R3 H8

ETH FDDI

PPP IP (376)PPP IP (512)PPP IP (512) (512)

ETH IP

ETH IP(512)ETH IP(376)

IP (1400) IP (1400)

R1 R2 R3

4500 MTU1500 MTU

532 MTU

•IP on H1 wants to send to H8 a 1420-byte packet (20-byte IP header plus 1400 bytes of data)

R2 must fragment the packet before routing it to RT3

•MTU of net2 = 1500 byte•MTU of net3 = 4500 byte•MTU of net4 = 532 byte•MTU of net4 = 1500 byte

Page 10: Internetworking: IP Packet Switching

10

Example (continued)

(a)

Ident = xStart of header

Rest of header

1400 data bytes

Offset = 00

(b)

Ident = xStart of header

Rest of header

512 data bytes

Offset = 01

Ident = x

Rest of header

512 data bytes

Offset = 641Start of header

Ident = xStart of header

Rest of header

376 data bytes

Offset = 1280

H1 R1 R2 R3 H8

ETH FDDI

PPP IP (376)PPP IP (512)PPP IP (512) (512)

ETH IP

ETH IP(512)ETH IP(376)

IP (1400) IP (1400)

R1 R2 R3

4500 MTU1500 MTU

532 MTU

1420-byte datagram (20-byte IP header plus 1400 bytes of data)

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•Offset field counts 8-byte chunks

Third fragment•contains last 376 bytes•offset (2 x 512)/ 8 = 128•M bit is 0

(b)

(a)

Page 11: Internetworking: IP Packet Switching

11

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

• Dot Notation– 10.3.2.4– 128.96.33.81– 192.12.69.77

Network Host7 24

0(a)

Network Host14 16

1 0(b)

Network Host21 8

1 1 0(c)

Page 12: Internetworking: IP Packet Switching

12

IP addresses (cont. I)• The original idea was that the Internet would

consist ofa) a small number of wide area networks (these would

be class A networks), 126

Network Host7 24

0(a)

Network Host14 16

1 0(b)

Network Host21 8

1 1 0(c)

Yes. Yes. Yes. Yes. Yes. Yes. Yes.\Yes. Yes. Yes. Yes. Yes. Yes. Yes.Yes. Yes. Yes. Yes. Yes. Yes. Yes.Yes. Yes. Yes. Yes. Yes. Yes. Yes.Yes. Yes. Yes. Yes. Yes. Yes. Yes.

1. 126 class A networks (the values 0 and 127 are reserved)

2. each class A network accommodate up to 224 - 2 (about 16 million) hosts (again, there are two reserved values)

Page 13: Internetworking: IP Packet Switching

13

IP addresses (cont. II)• The original idea was that the Internet would

consist ofa) a small number of wide area networks (these would

be class A networks), 126b) a modest number of site- (campus-) sized networks

(these would be class B networks)• 65,534 hosts /network

Network Host7 24

0(a)

Network Host14 16

1 0(b)

Network Host21 8

1 1 0(c)Yes. Yes. Yes. Yes. Yes. Yes. Yes.\Yes. Yes. Yes. Yes. Yes. Yes. Yes.

Page 14: Internetworking: IP Packet Switching

14

IP addresses (cont. III)• The original idea was that the Internet would

consist ofa) a small number of wide area networks (these would

be class A networks), 126b) a modest number of site- (campus-) sized networks

(these would be class B networks)• 65,534 hosts /network

c) a large number of LANs(these would be class C networks)• 254 hosts/LAN

• 255 reserved for broadcast• 0 not a valid host number

Network Host7 24

0(a)

Network Host14 16

1 0(b)

Network Host21 8

1 1 0(c)

Page 15: Internetworking: IP Packet Switching

15

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

Page 16: Internetworking: IP Packet Switching

16

Datagram Forwarding (cont.)

• Example: R2 Table Network Number Next Hop 1 R3 2 R1 3 interface 1 4 interface 0

R2

R1

H4

H5

H3H2H1

Network 2 (Ethernet)

Network 1 (Ethernet)

H6

Network 4(point-to-point)

H7 R3 H8

Network 3 (FDDI)

Page 17: Internetworking: IP Packet Switching

17

Address Translationa 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

Page 18: Internetworking: IP Packet Switching

18

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

Page 19: Internetworking: IP Packet Switching

19

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 link-layer 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

Page 20: Internetworking: IP Packet Switching

20

ARP: Notes

• mappings may change over time

• entries are timed out periodically and removed– discarded if not refreshed (in about 10 minutes)

Page 21: Internetworking: IP Packet Switching

21

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

Page 22: Internetworking: IP Packet Switching

22

ARP Packet Format

TargetHardwareAddr (bytes 25)

TargetProtocolAddr (bytes 03)

SourceProtocolAddr (bytes 23)

Hardware type = 1 ProtocolType = 0x0800

SourceHardwareAddr (bytes 45)

TargetHardwareAddr (bytes 01)SourceProtocolAddr (bytes 01)

HLen = 48 PLen = 32 OperationSourceHardwareAddr (bytes 0― 3)

0 8 16 31

― ― ―

Mapping IP into Ethernet Addresses

Page 23: Internetworking: IP Packet Switching

23

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

Page 24: Internetworking: IP Packet Switching

24

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