IPv4 Header
IPv4 Header
1. Version-
2. Header Length-
Header length is a 4 bit field that contains the length of the IP header.
It helps in knowing from where the actual data begins
The initial 5 rows of the IP header are always used.
So, minimum length of IP header = 5 x 4 bytes = 20 bytes.
The size of the 6th row representing the Options field vary.
The size of Options field can go up to 40 bytes.
So, maximum length of IP header = 20 bytes + 40 bytes = 60 bytes.
3. Type Of Service-
Type of service is a 8 bit field that is used for Quality of Service (QoS).
The datagram is marked for giving a certain treatment using this field.
4. Total Length-
Total length is a 16 bit field that contains the total length of the datagram (in bytes).
Minimum total length of datagram = 20 bytes (20 bytes header + 0 bytes data)
Maximum total length of datagram = Maximum value of 16 bit word = 65535 bytes
5. Identification-
Identification is a 16 bit field.
It is used for the identification of the fragments of an original IP datagram.
6.Flags- This is a three-bit field. The first bit is reserved (not used). The second bit is
called the do not fragment bit. If its value is 1, the machine must not fragment the
datagram. If it cannot pass the datagram through any available physical network, it
discards the datagram and sends an ICMP error message to the source host If its value is 0, the datagram can be fragmented if
necessary. The third bit is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment; there are
more fragments after this one. If its value is 0, it means this is the last or only fragment.
7. Fragment Offset-
8. Time To Live-
If the value of TTL becomes zero before reaching the destination, then datagram is discarded.
9. Protocol-
At each hop,
The header checksum is compared with the value contained in this field.
If header checksum is found to be mismatched, then the datagram is discarded.
Router updates the checksum field whenever it modifies the datagram header.
14. Options-
2. Source routing: A source routing option is used to specify the route that the datagram must take to reach the destination.
3. Padding: Addition of dummy data to fill up unused space in the transmission unit and make it conform to the standard
size is called as padding
IPv6
IPv6 fixed header is 40 bytes long and contains the following information.
2
Traffic Class (8-bits): These 8 bits are divided into two parts. The most significant 6 bits are used for Type of Service to let the
Router Known what services should be provided to this packet. The least significant 2 bits are used for Explicit Congestion
Notification (ECN).
3
Flow Label (20-bits): This label is used to maintain the sequential flow of the packets belonging to a communication. The source
labels the sequence to help the router identify that a particular packet belongs to a specific flow of information. This field helps
avoid re-ordering of data packets. It is designed for streaming/real-time media.
4
Payload Length (16-bits): This field is used to tell the routers how much information a particular packet contains in its payload.
Payload is composed of Extension Headers and Upper Layer data.
5
Next Header (8-bits): This field is used to indicate either the type of Extension Header, or if the Extension Header is not present
then it indicates the Upper Layer PDU. The values for the type of Upper Layer PDU are same as IPv4’s.
6
Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. This is same as TTL in IPv4. The value of
Hop Limit field is decremented by 1 as it passes a link (router/hop). When the field reaches 0 the packet is discarded.
7
Source Address (128-bits): This field indicates the address of originator of the packet.
8
Destination Address (128-bits): This field provides the address of intended recipient of the packet.
Differences between IPv4 and IPv6 Addresses
Here is the main difference between IPv4 and IPv6:
IPv4 IPv6
IPv4 has a 32-bit address length IPv6 has a 128-bit address length
The Security feature is dependent on application IPSEC is an inbuilt security feature in the IPv6 protocol
In IPv4 Encryption and Authentication facility not In IPv6 Encryption and Authentication are provided
provided
IPv4 can be converted to IPv6 Not all IPv6 can be converted to IPv4
Example of IPv6:
Example of IPv4: 66.94.29.13 2001:0000:3238:DFE1:0063:0000:0000:FEFB