The Internet Layer (RFC 791) is the second layer in the TCP/IP protocol stack. The main functions of the internet layer are transmitting data to and from the Network Access layer, routing data to the correct destination network and device on the destination network, and handling packet errors and fragmentation. Routing is the process of selecting best path / paths in a network along which to send the IP Datagrams (name of the data packet generated by the Internet Protocol) efficiently. IP Datagrams are encapsulated within an Ethernet Frame.
IP Datagram Encapsulated within an Ethernet Frame
The TCP/IP internet layer's functions are similar to the Layer 3 of the OSI model (Network Layer).
The major protocols included in the Internet layer are Internet Protocol (IP), Internet Control Message Protocol (ICMP), Address Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and Internet Group Management Protocol (IGMP).
Internet Protocol (IP)
The Internet Protocol (IP) implements two basic functions of network traffic 1) addressing of packets and 2) fragmentation of packets.
1) Routing of Internet Protocol (IP) Datagrams. Routing is the process of selecting best path / paths in a network along which to send the Internet Protocol (IP) Datagrams efficiently. The Internet Protocol (IP) layer use the Internet Protocol (IP) addresses (32 bit logical addresses represented in 4 octets) carried in the Internet Protocol (IP) datagram header to transmit the IP Datagrams toward their destination networks.
2) Fragmentation and Reassembly of Datagrams. To understand what is IP Datagram Fragmentation, first we should know the term MTU (Maximum Transmission Unit). MTU is the size (in bytes) of the largest packet or frame that can pass through a specific device or NIC card. While travelling through the network to reach the destination, the Internet Protocol (IP) datagrams may need to traverse different networks with heterogeneous MTUs. When a datagram is larger than the MTU of the network it need to traverse, it is divided into smaller fragments and are sent separately. At the destination computer the fragmented IP Datagram is reconstructed and this process in called reassembly.
Internet Protocol (IPv4) Datagram Header
Figure 7: Internet Protocol (IPv4) Datagram Header
Version: This 4-bit field indicates which version of Internet Protocol (IP) is being used. The current version of IP is v4. The binary pattern for 4 is 0100. The possible values for Version field are as shown in the table below.
||IP Version 4
||Stream IP Datagram mode (experimental protocol)
||IP Version 6
||The "P" internet protocol
Note: The TP/IX, "P" Internet protocol, and TUBA were the major protocols considered for the replacement of IPv4, but the industry embraced "IP Version 6" as the replacement for "IP Version 4" all other protocols mentioned above only have historical status.
IHL (Internet Header Length): This 4-bit field gives length of the Internet Protocol (IPv4) header in 32-bit words. The minimum length of an Internet Protocol (IPv4) header is five 32-bit words. The header bit pattern is 0101.
Type of Service: The "Type of Service" (ToS) field in the Internet Protocol (IPv4) header is an eight bit field, which provides an indication of the Quality of Service (QoS) desired, such as precedence, delay, throughput, and reliability.
The first three bits, Bits 0-2 indicates the Precedence value. The following are the possible combinations and the corresponding values.
|| Internetwork Control
The fourth bit indicates "Delay". The bit value “0” indicates normal delay and the bit value "1" indicate low delay.
The fifth bit indicates "Throughput". The bit value “0” indicates normal throughput and the bit value "1" indicate high throughput.
The sixth bit indicate "Reliability". The bit value “0” indicates normal reliability and the bit value "1" indicate high reliability.
The seventh bit indicates "Minimize monetary cost". The bit value “0” indicates normal monetary cost and the bit value "1" indicate minimize monetary cost.
The eight bit is reserved for future use and is termed as MBZ (Must be Zero)
The four bits which represent the ToS values can be summarized as below.
||Minimum monetary cost
Total Length: The "Total Length" is a 16-bit field which identifies the length (in bytes), of the Internet Protocol (IPv4) datagram. Total Length includes the length of Internet Protocol (IP4) header and the Data it carries. The minimum-length of an IP Datagram is 20 bytes (The minimum size of an IP header is 20 bytes and this is the case of an IP header carrying no data) and the maximum is 65,535 bytes (maximum possible value for a 16 bit number is 65,535).
Identification: The Identification field in the Internet Protocol (IPv4) header is a 16 bits field which indicates an identifying value assigned by the sender to aid in assembling the fragments of an IP Datagram. When a Datagram is fragmented in to multiple Datagrams, IP give all the fragments the same identification number and this number is used to identify IP fragments at the receiving side.
Flags: The three bit "Flags" field indicates fragmentation possibilities. The first bit is unused and should always have a value of zero. The next bit is called the DF (Don't Fragment) flag. DF flag set to "0" indicate that the IP Datagram can be fragmented and DF set to 1 indicate "Don't Fragment" the IP Datagram. The next bit is the MF (More Fragments) flag, which indicates that more fragments are on the way. When MF is set to 0, no more fragments need to be sent or the Datagram never was fragmented.
Fragment Offset: This field indicates where in the actual IP Datagram this fragment belongs. The fragment offset is measured in units of 8 octets (64 bits). The first fragment has offset zero.
Figure 8: IP Datagram Fragmentation
Consider the above figure. Network 1 and Network 3 has MTUs of 1500 bytes each and the MTU of Network 3 is only 1000 bytes. If Machine 1 sends a 1,500 byte Datagram (20-byte header and 1,480 bytes of data) to Machine 2, Router 1 must fragment the Datagram into two fragments, since the MTU for the Network 2 is only 1000 bytes.
1) The first fragment will contain 20 byte IP header
and 976 bytes of data. Also note that the Fragment offset is set to "0" (Since first fragment) and the MF (More Fragments) flag is set to "1".
2) The second fragment will contain a 20 byte IP header and 504 bytes of data. The fragment offset is set to 122 (976/8 = 122) and the MF (More Fragments) flag is set to "0". When the IP Datagram is fragmented to two, there is an additional 20 bytes of transfer which is the IP Datagram header size of the second fragment.
Time to Live (TTL): TTL is an 8 bit field and TTL indicates the amount of time in seconds or router hops that the Internet Protocol (IPv4) Datagram can survive before being discarded. Every router examines and decrements this field by at least 1, or by the number of seconds the Internet Protocol (IPv4) Datagram is delayed inside the router. The Internet Protocol (IPv4) Datagram is discarded when this field reaches zero.
Protocol: The 8-bit Protocol field indicates the protocol that will receive the data payload.
Header Checksum: This field holds a 16-bit calculated value to verify the validity of the header only. This field is recomputed in every router as the TTL field decrements.
Source IP Address: The 32 bit size IP address of the device which send this Internet Protocol (IPv4) Datagram.
Destination IP Address: The 32 bit size IP address of the device which is going to receive this IP Datagram.
IP Options: This field supports a number of optional header settings primarily used for testing, debugging, and security.
Padding: The Internet Protocol (IPv4) Options field may vary in length. The Padding field provides additional zero bits so that the total header length is an exact multiple of 32 bits.
Data: This field in the Internet Protocol (IPv4) Datagram Header contains the real Internet Protocol (IPv4) data payload and the size may vary. Contains data generated by TCP or UDP (Transport layer protocols), ICMP, or IGMP.
You have learned Internet Protocol (IPv4), Internet Protocol (IPv4) Datagram Header, different fields in an Internet Protocol (IPv4) header, and Internet Protocol (IPv4) Datagram fragmentation. The different fields of an IP header are Version, IHL, Type of Service, Total Length, Flags, Fragment offset, TTL (Time to Live), Protocol, Header Checksum, Source IP Address, Destination IP Address, IP Options, Padding and the Data Payload. Click "Next" to continue.
• TCP/IP Encapsulation and Decapsulation
• TCP/IP Network Access Layer
• Media Access Control (MAC) addresses
• IP Addresses