There are basically 3 components or 3 main parts of Network Layer. The 1st component is the Routing Protocols and Routing algorithms. The 2nd component is the IP protocol that covers the Network Layer datagram format and addressing the convention. The 3rd component is the Internet Control Message Protocol (ICMP) protocol that undertakes Error reporting and Router Signaling.
Remember that the Network Layer packet is said to be as Datagram.
IP Datagram Format
There are 2 versions of IP. IPv4 and IPv6. IPv4 is widely used in the internet. As the number of users is increasing every day, thus an alternative of IPv4 was developed (IPv6) in order to provide more number of IP addresses to the hosts.
IPv4 Datagram Format:
It tells the router about the version of IP whether it is version 4 or version 6. Because different version is processed differently. This field is of 4 bits.
2. Header Length:
This field tells you the size of IP header. There is a variable field in the IPv4 header. Like option can be there or not. So Header Length is usually used to tell, from where the actual Data is starting in an IP datagram. This field is of 4 bits.
3. Type of Service:
This field is used in IP header in order to allow the router to distinguish the type of application. For example, whether an Application is a Real-Time Datagrams such as for Video Calling or a Non Real-Time Datagrams such as for SMTP or FTP. This field is of 8 bits.
4. Datagram Length:
This field indicated the total size of the IP datagram i.e. IP header + Data. This field is of 16 bits.
5. Header Checksum:
This is used in order to detect the error in the IP datagram. Typically in most cases, if a router detects an error in a datagram, it discards that datagram. This field is of 16 bits.
6. Upper Layer Protocol:
This field indicates the name of the protocol that is being used in the above layer. Whether it is TCP or UDP. This field is used when the datagram reaches its destination. Then a number 6 in this field indicates, that TCP is used and a number 17 indicates that UDP is used at the Transport Layer. This field is of 8 bits.
7. Time-to-Live (TTL):
This field is used in order to ensure that the datagram is not circulated into the network for an unlimited period of time. For Example, in an infinite loop. Thus this field is decremented by one, every-time a datagram is processed at a router. Therefore when TTL becomes 0, the datagram is dropped. This field is of 8 bits.
8. Source and Destination IP address:
The source puts its own IP address in the source field and the address of the final destination in the destination field. The source often gets the IP address of the destination by a DNS lookup. Each of the source and destination address fields is 32 bits in IPv4 header.
9. Data :
This field contains the actual data to be transmitted to the destination. This field in an IP datagram contains the TCP segment to be transmitted. The field is 32 bits.
- The IPv4 header is 20 bytes. We assume that there is no option. If it is working over TCP, then the each IPv4 datagram carries a total of 40 bytes header (TCP header of 20 bytes and IP header of 20 bytes) + the Application Message.
10. Identifiers, Flags and Offset:
These 3 fields are used in order to break the datagrams into the smaller segments when a datagram is larger than a maximum limit arrives. Identifier field is of 16-bits, flags are of 3-bits, and fragmentation offset is of 13 bits.
******You can clearly see that the source IP address field is 32 bits. That means there can exist 2^32 different IP addresses on the Internet. This is almost equal to 4 billion IP addresses.*****
IPv6 Datagram Format:
1. Version :
Same as IPv4. It tells you about the version of the IP. Surely, in this case, the value will be 6. This field is of 4 bits.
2. Traffic Class:
This field is of 8 bits. This is similar to Type of Service field in IPv4. This tells the router about the Real Time or non-real time Applications.
3. Payload Length:
It is a 16-bit field, describing the size of data in IP datagram. It gives you the size of the Data field.
4. Next header:
It tells you the type of the upper layer protocol being used. This field is of 8 bits.
5. Hop Limit:
This Hop count is decreased by one at every router. When Hop Count reaches, the datagram is discarded. This field is of 8 bits.
6. Source and Destination IP address:
Each of the source and destination address fields are of 128 bits. That means, now Internet can have 2^128 different IP addresses. This unit is in trillions. Thus the internet now can be expanded much bigger than in IPv4.
7. Data :
It contains the Transport Layer header along with the original Application message.
- Now as the size of Source and destination IP address increases, the header size of IPv6 datagram is 40 bytes.
Advantages of IPv6:
2. A lot of fields are removed in IPv6. Such as Options field, making it a fixed length header, resulting in the faster processing of IP datagram.
3. There is no fragmentation of IPv6 datagram. If the datagram is large, the router simply drops it and sends a “Datagram too Large” ICMP error message.
4. The checksum is removed in IPv6 header. The developers thought that the checksum at the Transport layer is suitable. At network layer, it is getting redundant, so developers decided to remove checksum from network layer.
As IPv4 header contains a TTL field, thus checksum has to be processed at every router. Along with fragmentation, this is a very costly process.
Transformation from IPv4 to IPv6:
As you must know, that most of the routers around the globe are working on IPv4. And the present routers are not compatible of handling IPv6 datagrams. So what should be done to make them IPv6 compatible? One solution that some scientists give is that a flag day should be declared and all the networks of the world should be closed on that day for this transformation, and in that time the routers must be converted to IPv6. But do you really think that is it a possible solution with millions of systems on the Internet? Surely, I don’t think so.
Other solution can be that the new IPv6 routers can be made compatible of handling both the IPv4 and IPv6 datagrams. This is known as Dual Stack Approach. Such nodes or routers that are capable of implementing both are known as IPv4/IPv6 nodes. But a still a problem is there in this approach also. Let me explain you with an example:
Let me explain you with an example:
Suppose Router A wants to send an IPv6 datagram to Router F. But for transmitting a datagram to F, the datagram has to traverse through the intermediate routers B, C & D. But the router C & D are only IPv4 compatible routers. Now Router A will send an IPv6 datagram to B, but C is only IPv4 compatible. Thus, B has to send an IPv4 datagram to C.
So router B will copy the fields of IPv6 to IPv4 datagram router, and the appropriate mappings can be done. But you can see that, there are certainly some fields in IPv6 that doesn’t have a counterpart in IPv4. In such case, some fields will be lost. Since router E & F are capable of exchanging IPv6 datagram. But certainly, datagram arriving from D to E doesn’t contain all the fields originally sent by router A.
To overcome this dual Approach problem, we have a technique known as Tunneling. Tunneling will enable router E to receive the original datagram sent by router A. Let us take an Example given below. Suppose IPv6 compatible Router U and Router Z wants to inter-operate , but are connected by intermediate router W & X, that are IPv4 compatible only. Thus the intermediate IPv4 routers are referred to a Tunnel.
Now an IPv6 router on the sending side of the tunnel, say router V, puts a complete IPv6 datagram into the data field of IPv4 datagram. This IPv4 datagram is addressed to Router Y. Then this datagram is sent into the tunnel. The IPv4 router routes this datagram inside the tunnel among themselves, without knowing that the IPv4 datagram itself contains a complete IPv6 datagram inside it. And finally, the datagram reach router Y, where the IPv6 datagram is extracted from IPv4 and pass it on to Z. In this way, the IPv6 datagram reaches its destination without losing any fields.
Thank You for reading this article. We hope you enjoyed it.