Internet Protocol Version 4

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Internet Protocol Version 4-

 IPv4 short for Internet Protocol Version 4 is the fourth version of the Internet Protocol (IP).
 IP is responsible to deliver data packets from the source host to the destination host.
 This delivery is solely based on the IP Addresses in the packet headers.
 IPv4 is the first major version of IP.
 IPv4 is a connectionless protocol for use on packet-switched networks.

IPv4 Header-
The following diagram represents the IPv4 header-

1. Version-
 Version is a 4 bit field that indicates the IP version used.
 The most popularly used IP versions are version-4 (IPv4) and version-6 (IPv6).
 Only IPv4 uses the above header.
 So, this field always contains the decimal value 4.

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.
Minimum And Maximum Header Length-

The length of IP header always lies in the range-


[20 bytes , 60 bytes]

 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).

Total length = Header length + Payload length

 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.

When an IP datagram is fragmented,


 Each fragmented datagram is assigned the same identification number.
 This number is useful during the re assembly of fragmented datagrams.
 It helps to identify to which IP datagram, the fragmented datagram belongs to.

6. DF Bit-

 DF bit stands for Do Not Fragment bit.


 Its value may be 0 or 1.

When DF bit is set to 0,


 It grants the permission to the intermediate devices to fragment the datagram if required.
When DF bit is set to 1,
 It indicates the intermediate devices not to fragment the IP datagram at any cost.
 If network requires the datagram to be fragmented to travel further but settings does not allow its
fragmentation, then it is discarded.
 An error message is sent to the sender saying that the datagram has been discarded due to its settings.

7. MF Bit-

 MF bit stands for More Fragments bit.


 Its value may be 0 or 1.
When MF bit is set to 0,
 It indicates to the receiver that the current datagram is either the last fragment in the set or that it is the
only fragment.
When MF bit is set to 1,
 It indicates to the receiver that the current datagram is a fragment of some larger datagram.
 More fragments are following.
 MF bit is set to 1 on all the fragments except the last one.

8. Fragment Offset-

 Fragment Offset is a 13 bit field.


 It indicates the position of a fragmented datagram in the unfragmented IP datagram.
 The first fragmented datagram has a fragment offset of zero.

Fragment offset for a given fragmented datagram


= Number of data bytes ahead of it in the original unfragmented datagram

9. Time To Live-

 Time to live (TTL) is a 8 bit field.


 It indicates the maximum number of hops a datagram can take to reach the destination.
 The main purpose of TTL is to prevent the IP datagrams from looping around forever in a routing loop.
The value of TTL is decremented by 1 when-
 Datagram takes a hop to any intermediate device having network layer.
 Datagram takes a hop to the destination.

If the value of TTL becomes zero before reaching the destination, then datagram is discarded.

10. Protocol-

 Protocol is a 8 bit field.


 It tells the network layer at the destination host to which protocol the IP datagram belongs to.
 In other words, it tells the next level protocol to the network layer at the destination side.
 Protocol number of ICMP is 1, IGMP is 2, TCP is 6 and UDP is 17.

11. Header Checksum-


Header checksum is a 16 bit field.
 It contains the checksum value of the entire header.
 The checksum value is used for error checking of the header.

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.

The fields that may be modified are-


1. TTL
2. Options
3. Datagram Length
4. Header Length
5. Fragment Offset
12. Source IP Address-

 Source IP Address is a 32 bit field.


 It contains the logical address of the sender of the datagram.

13. Destination IP Address-

 Destination IP Address is a 32 bit field.


 It contains the logical address of the receiver of the datagram.
14. Options-

 Options is a field whose size vary from 0 bytes to 40 bytes.


 This field is used for several purposes such as-
1. Record route
2. Source routing
3. Padding

1. Record Route-

 A record route option is used to record the IP Address of the routers through which the datagram
passes on its way.
 When record route option is set in the options field, IP Address of the router gets recorded in the
Options field.

 The maximum number of IPv4 router addresses that can be recorded in the Record Route
option field of an IPv4 header is 9.

2. Source Routing-

 A source routing option is used to specify the route that the datagram must take to reach the
destination.
 This option is generally used to check whether a certain path is working fine or not.
 Source routing may be loose or strict.

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.
 Options field is used for padding.

You might also like