Datagram Fragmentation, ICMP & Ipv6
Total Page:16
File Type:pdf, Size:1020Kb
Lecture 10 Datagram Fragmentation, ICMP & IPv6 • IP Datagram Encapsulation • Network Maximum Transmission Unit (MTU) • IP Datagram Fragmentation • ICMP (Internet Control Message Protocol) - Error Report Mechanism - Information Query Mechanism - ICMP Message format and Transmission - ping and traceroute Utilities • IPv6 - IPv6 Features - IPv6 Header and Format - IPv6 Address Lecture 10 Internet Transmission Paradigm IP D IP D IP D IP D IP D Source router router router Destination host Routing Routing Routing host Routing network Table network Table network Table network Routing Table --------- --------- --------- Table --------- ## *** ## *** ## *** --------- ## *** ………… ………… ………… ## *** ………… ………… • Source host - Forms datagram with destination address - Sends to nearest router • Intermediate routers - Forward datagram to next router • Final router - Delivers to destination host Note: Datagram must be passed to network interface & sent across physical network. Network hardware does not recognize IP datagram format and IP address !! How is datagram transmitted across physical network ?? Address Resolution (ARP) and Encapsulation !! Lecture 10 IP Datagram Encapsulation IP Datagram/Packet IP Header IP Data Area Encapsulated into a frame/packet in lower layer Frame Header Frame Data Hardware Network Frame/Packet • Entire datagram treated like data encapsulated in a frame for transmission • Frame type (0800 for Ethernet) identifies contents as IP datagram Ethernet Frame • Frame destination address gives next hop • Next hop Frame/Hardware Address is obtained by address resolution protocol (ARP) • IP address will not be changed while frame address is different in different network Lecture 10 Encapsulation Across Multiple Hops Animation • Each router extracts datagram, discard frame, determines next hop via ARP, encapsulates datagram in outgoing frame • Frame headers may differ depended upon network types • Datagram survives in entire trip, but frame only survives one hop Lecture 10 Maximum Transmission Unit (MTU) • Every hardware technology specification includes the definition of the maximum size of the frame data area - called maximum transmission unit (MTU) • IP datagrams can be larger than most hardware MTUs - IP: (216 – 1) bytes = 64K bytes - Ethernet: 1500 bytes - Token ring: 4464 bytes - FDDI: 4352 bytes - X.25: 576 bytes Ethernet Frame - PPP: 296 bytes (Point-to-Point Protocol) • Any datagram encapsulated in a hardware frame must be smaller than the MTU for that hardware • An internet may have networks with different MTUs Lecture 10 Datagram Fragmentation • Fragmentation: a technique to limit datagram size to smallest MTU of any network • IP uses fragmentation – split datagrams into pieces to fit in network with small MTU • Router detects datagram larger than network MTU - Splits into pieces called fragments - Each piece smaller than output network MTU • Each fragment has datagram header and is sent separately • Ultimate destination reassembles fragments > MTU Each <= MTU Fragment 1 Fragment 2 Fragment 3 Fragmentation Fragmentation No-fragmentation Assemble fragments No-assemble No-assemble Lecture 10 Datagram Fragmentation & Reassembly Network links have MTU - Different link types with Different MTUs Fragmentation: * 1500 bytes for Ethernet in: one large datagram * 296 bytes for PPP out: 3 smaller datagrams large IP datagram divided (“fragmented”) within net Reassembly one datagram becomes several datagrams “reassembled” only at the final destination IP header bits used to identify, order related fragments Lecture 10 Fragment Related Fields in IP Header Identification - Datagram ID - 16 bits counter Flag - Signal fragment. - 3 bits, ABC A: reserved B: 1 – no fragment 0 - fragmented C: 1 - not last fragment 0 - last fragment Fragment offset - Payload data location - Numbers of 8 bytes - 13 bits Lecture 10 An Example of Datagram Fragmentation Example length ID fragflag offset MTU = 1500 bytes =4020 =x =0 =0 4020 byte IP datagram If one fragment is 20 byte IP header One large datagram becomes lost, IP discards all 4000 byte payload several smaller datagrams fragments 3 fragments: F1, F2, F3 length ID fragflag offset 4000=1480+1480+1040 F1 =1500 =x =1 =0 1480 bytes in length ID fragflag offset data field F2 =1500 =x =1 =185 offset = multiple of 8 bytes so 1480/8 = 185 length ID fragflag offset F3 185+185 = 370 =1040 =x =0 =370 ID: set by sending host IP layer; typically increments ID num for each datagram it sends. Last fragment sent has flag field set to 0 to indicate it’s the last fragment; all other fragments have flag set to 1 Lecture 10 Sub-fragmentation and Fragment Loss • Fragment may encounter a subsequent network with even smaller MTU • Router fragments the fragment to fit • Resulting (sub)fragments look just like original fragments (except for size) • No need to reassemble hierarchically; (sub)fragments include position in datagram • IP may drop fragment • What happens when a fragment is lost? Destination drops entire original datagram • How does destination identify lost fragment? (sub)fragments - Sets timer with each fragment IP Hdr21 data21 IP Hdr22 data22 - If timer expires before all fragments arrive, fragment assumed lost - Datagram dropped • Source (transport/application layer protocol) assumed to retransmit Lecture 10 IP Datagram Errors and ICMP IP provides best-effort delivery Datagrams will be dropped if the following errors are detected - corrupted bits detected by header checksum - illegal address detected by routers (routing table) and ARP reply - routing loop detected by Time-To-Live (TTL) field - fragment loss detected by timeout IP ignores errors, but reports some errors !! Internet Control Message Protocol (ICMP) is a protocol to report errors and provide some information. - Error reporting function Report problems that a router or a destination host encounters when it processes an packet via sending an ICMP message TO a source host - Information query function Help a source host or a network manager get specific information from a router or another host Lecture 10 Error Report and Information Query Mechanism Error report mechanism IP datagram with error Router X Dropped with error x Router x Dropped Router Source Destination ICMP datagram Host ICMP datagram Host for error report for error report Information query mechanism ICMP datagram for information query Router q q q Router q r r Router r Source ICMP datagram r Destination Host for reply ICMP datagram Host for reply Lecture 10 ICMP Message Format and Transmission - ICMP includes both error messages and information messages - ICMP message consists of ICMP header and ICMP data - ICMP encapsulates message in IP data area for transmission - ICMP datagram is processed and forwarded like conventional IP datagram ICMP Message ICMP Header ICMP Data Area ICMP Datagram Encapsulated IP Header IP Data Area IP Header: type=1 for ICMP message ICMP Header 0 8 16 24 31 Type Code Checksum Identifier Sequence Num. Encapsulated Type: error/information type Code: detailed error type ICMP Message Types • Error messages: - Source quench (type=4) too many datagrams to buffer in a router - Time exceeded (type=11) TTL becomes zero in a router (code=0) fragment reassembly timer expires in a host (code=1) - Destination unreachable (type=3, code=1~15) network disconnection or destination host is powered down or TCP/application not run, firewall, etc • Information query messages: (a pair) - Request/reply (type=8: request, type=0: reply) - Timestamp request/reply (type=13: request, type=14: reply) - Address mask request/reply (type=17: request, type=18: reply) Lecture 10 ICMP, Host Reachability and Internet Route An internet host A is reachable from another host B if datagrams can be delivered from A to B ping utility tests reachability - Sends datagram from B to A that A echoes back to B - Uses ICMP echo request and echo reply messages Command format: ping IP-address/Host-name ping & other network utilities List of all routers on path from A to B is called the route from A to B traceroute uses UDP to non-existent port and TTL field to find route - Sends ICMP echo messages with increasing TTL - Router that decrements TTL to 0 sends ICMP time exceeded message, with router's address as source address ICMP & TraceRT Anim1 - First, with TTL=1, gets to first router, which discards and sends time exceeded message ICMP & TraceRT Anim2 - Next, with TTL=2, gets through first router to second router - Continue, with TTL=3, 4, …, until message from destination received Command format for Unix/Linux: traceroute IP-address/Host-name Command format for Windows: tracert IP-address/Host-name Lecture 10 Motivation for Change from IPv4 to IPv6 - Current version of IPv4 - is more than 30 years old - IPv4 has shown remarkable success !!! - Then why change? Address space - 32 bit address space allows for over a million networks - But...most are Class C and too small for many organizations - 214 = 16384 Class B network addresses already almost exhausted Type of service - Different applications have different requirements for delivery reliability & speed - Current IPv4 has type of service that's not often implemented - Effective multimedia communication - Data encryption and authentication Multicast One next version is called IPv6 ! Lecture 10 New Features in IPv6 - Large address size – 128 bits = 16 bytes - Better header format - entirely different - Base header – 40 bytes - Extension headers - Additional information stored in optional extension headers - Support