Network Layer Packet Forwarding IS 250 Spring 2010

  • Slides: 27
Download presentation
Network Layer Packet Forwarding IS 250 Spring 2010 chuang@ischool. berkeley. edu John Chuang

Network Layer Packet Forwarding IS 250 Spring 2010 chuang@ischool. berkeley. edu John Chuang

Packet Switching Backbone MAN Ethernet Local loop Host A Host B 12. 2. 14.

Packet Switching Backbone MAN Ethernet Local loop Host A Host B 12. 2. 14. 60 128. 32. 226. 87 John Chuang 2

Two Basic Functions in Packet Switching § Routing - Learn the best route to

Two Basic Functions in Packet Switching § Routing - Learn the best route to (or best next-hop for) any given destination - Exchange local link status or destination reachability information - Compute best path to destinations • Algorithms for computing shortest paths (e. g. , Dijkstra’s) • Policies that reflect business agreements (use BGP) - Update the routing table § Packet forwarding - For each packet received on an incoming link, forward it to an outgoing link according to the routing table John Chuang 3

L 3 Outline § Addressing: - Internet Protocol (IP): address notation; address allocation; address

L 3 Outline § Addressing: - Internet Protocol (IP): address notation; address allocation; address translation § Packet switching: - Routing: BGP, OSPF, RIP - Packet forwarding: IP fragmentation, TTL, … § Extensions: - IP Multicast; Qo. S; Mobile IP; IPSec; … § Evolution: - IPv 6 John Chuang 4

IP Packet aka IP Datagram § Header - Contains destination address - Fixed-size fields

IP Packet aka IP Datagram § Header - Contains destination address - Fixed-size fields § Payload - Variable size up to 64 K - No minimum size John Chuang 5

Internetworking Standards § Internetworking standards set by IETF (Internet Engineering Task Force) § Documented

Internetworking Standards § Internetworking standards set by IETF (Internet Engineering Task Force) § Documented as RFCs (Requests for Comment): - RFC RFC 791: IP 793: TCP 2460: IPv 6 1034, 1035: DNS § http: //www. ietf. org/rfc. html John Chuang 6

IPv 4 Datagram Bit 0 Bit 31 Header Version (4) Hdr Len (4) TOS

IPv 4 Datagram Bit 0 Bit 31 Header Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Data Options (if any) John Chuang Data (variable length) 7

IP Packet Header § Version - Version number of IP protocol - Current version

IP Packet Header § Version - Version number of IP protocol - Current version is Version 4 - Version 6 has different header format Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 8

IP Packet Header § Header Length (in 32 bit words) - Indicates end of

IP Packet Header § Header Length (in 32 bit words) - Indicates end of header and beginning of payload - If no options, Header length = 5 Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 9

IP Packet Header § Type of Service (TOS) - Allows different types of service

IP Packet Header § Type of Service (TOS) - Allows different types of service to be requested - Initially, meaning was not well defined - Different subsequent attempts to define (e. g. , diffserv) Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 10

IP Packet Header § Packet Length (in Bytes) - Unambiguously specify end of packet

IP Packet Header § Packet Length (in Bytes) - Unambiguously specify end of packet - Max packet size = 216 – 1 = 65, 535 Bytes Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 11

IP Packet Header § These three fields for Fragmentation Control (will come back to

IP Packet Header § These three fields for Fragmentation Control (will come back to them later) Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 12

IP Packet Header § Time to Live - For avoiding infinite routing loops Initially

IP Packet Header § Time to Live - For avoiding infinite routing loops Initially set by sender (up to 255) Decremented by each router Discard when TTL = 0 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 13

IP Packet Header § Protocol - Value indicates what is in the data field

IP Packet Header § Protocol - Value indicates what is in the data field - Example: TCP or UDP Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 14

IP Packet Header § Header Checksum - Checks for error in the header only

IP Packet Header § Header Checksum - Checks for error in the header only - Bad headers can harm the network - If error found, packet is simply discarded Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 15

IP Packet Header § Source and Destination IP Addresses - Strings of 32 ones

IP Packet Header § Source and Destination IP Addresses - Strings of 32 ones and zeros Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 16

IP Packet Header § Options - Example: timestamp, record route, source route Bit 0

IP Packet Header § Options - Example: timestamp, record route, source route Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 17

IP Fragmentation & Reassembly § Maximum Transmission Unit (MTU) - Largest IP packet a

IP Fragmentation & Reassembly § Maximum Transmission Unit (MTU) - Largest IP packet a network will accept - Arriving IP packet may be larger (max IP packet size = 65, 535 bytes) § Sender or router will split the packet into multiple fragments § Destination will reassemble the packet § IP header fields used to identify and order related fragments John Chuang MTU = 4352 MTU = 1500 18

Illustration of Datagram Fragmentation § Each fragment has IP datagram header § Header fields

Illustration of Datagram Fragmentation § Each fragment has IP datagram header § Header fields - Identify original datagram - Indicate where fragment fits John Chuang 19

IP Packet Header § Identification - All fragments of a single datagram have the

IP Packet Header § Identification - All fragments of a single datagram have the same identification number Bit 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 20

IP Packet Header § Flags: - 1 st bit: reserved, must be zero -

IP Packet Header § Flags: - 1 st bit: reserved, must be zero - 2 nd bit: DF -- Do Not Fragment - 3 rd bit: MF -- More Fragments Bit 0 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Bit 31 Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 21

IP Packet Header § Fragment Offset (in units of 8 bytes) - Used for

IP Packet Header § Fragment Offset (in units of 8 bytes) - Used for reassembly of packet - 1 st fragment has offset = 0 Bit 31 Version (4) Hdr Len (4) TOS (8) Identification (16 bits) Time to Live (8) Protocol (8) Total Length in bytes (16) Flags (3) Fragment Offset (13) Header Checksum (16) Source IP Address Destination IP Address Options (if any) John Chuang 22

IP Fragmentation Example § Host A wants to send to Host B an IP

IP Fragmentation Example § Host A wants to send to Host B an IP datagram of size = 4000 Bytes MTU = 4352 John Chuang MTU = 1500 23

IP Fragmentation Example length ID =4000 =x MF =0 offset =0 One large datagram

IP Fragmentation Example length ID =4000 =x MF =0 offset =0 One large datagram becomes several smaller datagrams length ID =1500 =x MF =1 offset =0 length ID =1500 =x MF =1 offset =185 length ID =1040 =x MF =0 offset =370 Offsets in units of 8 bytes John Chuang 24

Multiple Fragmenting Points § Let MTUs along path be: - 1500 1000 1500 576

Multiple Fragmenting Points § Let MTUs along path be: - 1500 1000 1500 576 1500 § Result: fragmentation can occur twice John Chuang 25

Fragmenting a Fragment § Needed when fragment too large for network MTU § Arbitrary

Fragmenting a Fragment § Needed when fragment too large for network MTU § Arbitrary sub-fragmentation possible § Router divides fragments into smaller pieces § All fragments at same “level” - Offset given with respect to original datagram - Destination cannot distinguish sub-fragments John Chuang 26

Fragment Loss § Receiver - Collects incoming fragments - Reassembles when all fragments arrive

Fragment Loss § Receiver - Collects incoming fragments - Reassembles when all fragments arrive - Does not know identity of router that did fragmentation - Cannot request missing pieces § Consequence: loss of one fragment means entire datagram lost John Chuang 27