Network Layer III (IP) Internet Protocol/ Network Layer 1 Position of IP in TCP/IP protocol suite 2 Internet Protocol (IP) a) The IP is the host-to-host network layer delivery protocol for Internet. b) IP is a connectionless datagram protocol for packet switching network. c) Best effort delivery service: meaning that IP provides no error control or flow control. (e.q. post office does not keep track of every letter) d) IP uses only an error detection mechanism (Chechsum) and discards the packet if it is corrupted. e) IP does its best to deliver a packet to its destination, but with no guarantees. Needs to rely on TCP layer for reliable delivery. 3 IP Datagram • Packets in the IP layer are called Datagrams. • A datagram is a variable-length packet consisting of header and data: • Header: 20 to 60 bytes in length containing essential information for routing and addressing • It is customary to show the header in 4-byte sections. • VER: defines the IP version (IPv4). • HLEN: num of 4-byte sections; multiplied by 4 to give it’s the actual length in bytes • Total length: of IP datagram in bytes; • Data length = Total length – header length • Time to live: to control max no. of hops visited by a datagram by count decrement. • Protocol: specifies final dest. protocol to which IP datagram should be delivered; TCP(6), UDP(17), ICMP(1), IGMP(2) • Checksum: covers only header field for testing & debug4 Protocol field: 6 1 2 17 89 This field defines the higher level protocol (transport-layer) that uses the services of IP-layer. An IP datagram can encapsulate data from several higher-level protocols such as: TCP=6, UDP=17, ICMP=1, IGMP=2, OSPF=89. This field specifies the final destination protocol to which the IP datagram should be delivered. Since IP multiplexes and demultiplexes data from different higher level protocols, the value of this field helps in the demultiplexing process when the datagram arrives at its final destination. 5 Example 1 An IP packet has arrived with the first 8 bits (leftmost) as shown: 01000010 The receiver discards the packet. Why? Solution There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length, which means (2 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission. Note that only HLEN field uses (x4) to get the header length 6 Example 2 In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet? Solution The HLEN field value is 8, which means the total number of bytes in the header is 8 4 or 32 bytes. The first 20 bytes are the main header, the next 12 bytes are the options. 7 Example 3 In an IP packet, the value of HLEN is 516 (or 0101) and the value of the total length field is 002816 (or 00101000). How many bytes of data are being carried by this packet? Solution The HLEN value is 5, which means the total number of bytes in the header is 5 4 or 20 bytes (no options). The total length is 28(hex) = 001010002 = 40 bytes, which means the packet is carrying 20 bytes of data. Data length = total length – header length = (40-20) = 20. Only HLEN field uses (×4) to get header length 8 Example 4 An IP packet has arrived with the first few hexadecimal digits as shown below: 45000028000100000102................... How many hops can this packet travel before being dropped? The data belong to what upper layer protocol? Solution To find the time-to-live field, we should skip 8 bytes (16 hexadecimal digits). 4 bits (binary) = 1 bit (hex); 1 byte = 8 bits binary = 2 bits (hex) The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol 9 is IGMP. Internet Protocol version 6: IPv6 22 IPv6 a) Although IPv4 was well designed, it is clear that IPv4 is becoming insufficient for the fast growing Internet and the needs: • Due to growing demand of internet usage, the use of addressing space is becoming insufficient for conventional netid & hostid two-level addressing structure in Classful addressing. • Real-time application i.e. video transmission requires minimum delay strategies and reservation of resource not provided in IPv4 • Encryption and authentication of data and security mechanism not provided in IPv4. • Limitation of flexibility and mobility supported in IPv4. b) In IPv6, the internet protocol was extensively modified to accommodate the unforeseen growth of Internet. 23 Improvement in IPv6 a) IPv6 has some advantages over IPv4: • Longer addresses than IPv4: 128 bits long > 32 bits currently in IPv4. It is large enough for every grain of sand on earth to be IP addressable.. • Simplification in Header: contains only 8 vital fields < 13 in IPv4. (speeds up routing process). – 5 fields becomes options. • New options: to support additional functionalities • Security: Authentication & privacy are key features of new IP • More Services: to handle special/real-time multimedia traffic. 24 The IPv4 header Changed 0 bits 4 Ver 8 IHL 16 24 Service Type Identifier Time to Live Removed Total Length Flags Protocol 31 Fragment Offset Header Checksum 32 bit Source Address 32 bit Destination Address Options and Padding September 2006 UKERNA IPv6 Workshop 25 IPv4 datagram Totally remove bcs fixed 40 bytes header is used Replaced by Hop limit in IPv6 Replaced by Flow label in IPv6 Taken out bcs Next header in IPv6 tells what follows the last IP header (e.g. a UDP or TCP) All replaced by functions in both Next header & payload extension header: fragmentation in IPv6 Replaced by payload length in IPv6 Totally removed bcs calculating this greatly reduce performances. Data-link and Transport layer have their own checksum for 26 better support of reliability, Format of an IPv6 datagram 32 bits Base Header: Occupies 40 bytes Payload: Extension header + Data from upper layer Occupies up to 65535 bytes 27 The changes made in IPv6 with regard to IPv4 are compared as follows 28 IPv6 packet field a) VER: IP version; 4 for IPv4 and 6 for IPv6 b) PRI: priority field defines priority of packets w.r.t. traffic congestion; 0-7: for packets that can slow down in event of congestion; 8-15 for real-time traffic with constant sending rate – Audio & Video. c) Flow label: (~ Service in IPv4) Special handling for a particular flow of data; pseudo-connection btw source and dest. for reserved bandwidth and stringent delay requirement. (Still experimental). d) Payload length: tells how many payload bytes follow the 40-bytes header; excluding the count for header based – 40 bytes not included e) Next header: 8-bit field defines the subsequent headers that follow the base header to allow extension; either optional extension headers used by IP or header for an upper-layer protocol, e.g. UDP & TCP. f) Hop limit: serves the same purpose as the TtL in IPv4. g) Source and Destination address field: both occupy 16 bytes (128 bits) h) Extension Headers: 6 extension headers which is optional in IPv4. 29 IPv6 datagram 30 Extension header format 31 IPv6 address IPv4 4 bytes 32 bits 39 Abbreviated address 40 Abbreviated address with consecutive zeros Two or more groups of 16 zeros can be replaced by a pair of colons 41 CIDR address 42 Transition from IPv4 (95%) to IPv6 a) Because of huge number of systems on the Internet, the transition from IPv4 to IPv6 cannot happen suddenly. b) It will take considerable amount of time before every system in the Internet can move from IPv4 to IPv6 c) The transition should be a smooth process to prevent any problems due to their differences. d) 3 transition strategies: • Dual stack • Tunnelling • Header translation 43 IP V6 usage 44 Per-country IP V6 adoption IP V6 adoption UK: 0.32% Belgium: 29.1% On 5/11/2014 https://www.google.com/intl/en/ipv6/statistics.html#tab=per-country-ipv6-adoption 45 Three transition strategies 46 Dual stack A station should simultaneously run both IPv4 & IPv6 protocols until all Internet uses IPv6. To determine which version to use, the source host queries the DNS and send whichever version of IP packet the DNS returns. 47 Tunneling Tunnelling is a strategy used when two hosts using IPv6 want to connect with each other when the packet must pass through a region that uses IPv4. To pass thru the region, packet must have an IPv4 address. So, the IPv6 packet is encapsulate in an IPv4 packet when it enters the region, and IPv6 leaves its capsule when it exits the region. 48 Header translation Header translation is necessary when majority of the Internet has moved to IPv6 but some systems still use IPv4. The sender wants to use IPv6 but the receiver does not understand IPv6. Tunnelling does not work because packet must be in the IPv4 format to be understood by the receiver. In this case, the header format must be changed totally through header translation to down-convert from IPv6 to IPv4 header. 49 Further Reading 1- “Computer Networks”, Andrew Tanenbaum, 4th Ed. to learn more about the generic network layer. 2- “Internetworking with TCP/IP vol.1”, Douglas Comer, 4th Ed., provides a detailed and comprehensive presentation of TCP/IP. 3- “Data Communications and Networking”, Behrouz Forouzan, 4th Ed., 4- https://www.google.com/intl/en/ipv6/index.html Copyright Information : Some figures used in this presentation have been either directly copied or adapted from several books. 50