240 likes | 356 Views
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
E N D
Internetworking:IP Packet Switching Reading: 4.1.1 - 4.1.7 (except Implementation; pp. 245-250 )
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 largepercentage of networks are now connected • Learn the principles of internetworking • illustrate ideas with real-world examples from Internet
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
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
Packet Format: 20 to 24 byte Header I • Version • HLen: length of header in 32-bit words • TOS, Type of Service: allow packets to be treated differently based on application needs • Length: bytes of datagram (including header, max 65,535) • Indent, Offset , Flag: information used for fragmentation
Packet Format: 20 to 24 byte Header II • TTL, time to live: discard looping packets; 64 is the current default • Protocol: higher-level protocol (TCP = 6, UDP =17, …) • Checksum: calculated for IP header considered as a sequence of 16-bit words • SourceAddr, DestinationAddr: IP defines its own global address space, independent of physical networks • Options, Pad: rarely use
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: • 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 • fragment when necessary • whenever the path to destination includes a network with MTU < Datagram
Design Decisions (cont.) • re-fragmentation is possible • a router wants to forward a datagram over a network with MTU < received datagram • fragments are self-contained datagrams • 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 • do not recover from lost fragments • If all fragments do not arrive at receiving host, it discards fragments that arrived
Example 1500 MTU 4500 MTU 532 MTU • 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 R2 must fragment the packet before routing it to RT3
Example (continued) Start of header • First fragment • M bit 1 in the Flags field (more fragments to follow) • Offset 0 (fragment contains first part of original datagram) Ident = x 0 Offset = 0 Rest of header (a) 1400 data bytes 1420-byte datagram (20-byte IP header plus 1400 bytes of data) • 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 Start of header Ident = x 1 Offset = 0 Rest of header 512 data bytes (b) (a) Start of header Ident = x 1 Offset = 64 Rest of header 4500 MTU 1500 MTU 512 data bytes (b) 532 MTU Start of header Ident = x 0 Offset = 128 Rest of header • Third fragment • contains last 376 bytes • offset (2 x 512)/ 8 = 128 • M bit is 0 376 data bytes
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
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. IP addresses (cont. I) • The original idea was that the Internet would consist of • a small number of wide area networks (these would be class A networks), 126 • 126 class A networks (the values 0 and 127 are reserved) • each class A network accommodate up to 224 - 2 (about 16 million) hosts (again, there are two reserved values)
Yes. Yes. Yes. Yes. Yes. Yes. Yes.\ Yes. Yes. Yes. Yes. Yes. Yes. Yes. IP addresses (cont. II) • The original idea was that the Internet would consist of • a small number of wide area networks (these would be class A networks), 126 • a modest number of site- (campus-) sized networks (these would be class B networks) • 65,534 hosts /network
IP addresses (cont. III) • The original idea was that the Internet would consist of • a small number of wide area networks (these would be class A networks), 126 • a modest number of site- (campus-) sized networks (these would be class B networks) • 65,534 hosts /network • a large number of LANs (these would be class C networks) • 254 hosts/LAN • 255 reserved for broadcast • 0 not a valid host number
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
Datagram Forwarding (cont.) • Example: R2 Table Network Number Next Hop 1 R3 2 R1 3 interface 1 4 interface 0
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
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
Executing ARP • “originator” host broadcast an ARP query containing “target IP address” and {IP address; link-layer address} of originator host • if a host on network already has an entry for originator host, it “refreshes” this entry (resets length of time until it discards entry) • target host adds information about originator to its table & sends back a response message that contains its link-layer address • originator adds information contained in the response to its ARP table • all other hosts do not add an entry for the originator host
ARP: Notes • mappings may change over time • entries are timed out periodically and removed • discarded if not refreshed (in about 10 minutes)
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
0 8 16 31 Hardware type = 1 ProtocolType = 0x0800 HLen = 48 PLen = 32 Operation SourceHardwareAddr (bytes 0 ― 3) ― 5) ― 1) SourceHardwareAddr (bytes 4 SourceProtocolAddr (bytes 0 SourceProtocolAddr (bytes 2 TargetHardwareAddr (bytes 0 ― 3) ― 1) ― 5) TargetHardwareAddr (bytes 2 TargetProtocolAddr (bytes 0 ― 3) Mapping IP into Ethernet Addresses ARP Packet Format
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
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