0xnhl

Back

Internet Protocol (IP)

Created: 1/12/2026 Updated: 1/12/2026

The Internet Protocol (IP) is the fundamental set of rules (protocol) that governs how data packets are addressed, routed, and delivered across networks, enabling communication between devices on the internet.
IP operates as the foundation for all communications over the internet.

IP ensures that packets reach their destinations. There are two versions of IP that you will find in use today: IPv4 and IPv6. Both versions use different headers to structure packet information.

IPv4 packet#

IPv4 is the most commonly used version of IP.


An IPv4 packet is made up of two sections, the header and the data:

  • An IPv4 header format is determined by the IPv4 protocol and includes the IP routing information that devices use to direct the packet. The size of the IPv4 header ranges from 20 to 60 bytes. The first 20 bytes are a fixed set of information containing data such as the source and destination IP address, header length, and total length of the packet. The last set of bytes can range from 0 to 40 and consists of the options field.

  • The length of the data section of an IPv4 packet can vary greatly in size. However, the maximum possible size of an IPv4 packet is 65,535 bytes. It contains the message being transferred over the internet, like website information or email text.

There are 13 fields within the header of an IPv4 packet:

  • Version (VER): This 4 bit component tells receiving devices what protocol the packet is using. The packet used in the illustration above is an IPv4 packet.
  • IP Header Length (HLEN or IHL): HLEN is the packet’s header length. This value indicates where the packet header ends and the data segment begins. 
  • Type of Service (ToS): Routers prioritize packets for delivery to maintain quality of service on the network. The ToS field provides the router with this information.
  • Total Length: This field communicates the total length of the entire IP packet, including the header and data. The maximum size of an IPv4 packet is 65,535 bytes.
  • Identification: IPv4 packets can be up to 65, 535 bytes, but most networks have a smaller limit. In these cases, the packets are divided, or fragmented, into smaller IP packets. The identification field provides a unique identifier for all the fragments of the original IP packet so that they can be reassembled once they reach their destination.
  • Flags: This field provides the routing device with more information about whether the original packet has been fragmented and if there are more fragments in transit.
  • Fragmentation Offset: The fragment offset field tells routing devices where in the original packet the fragment belongs.
  • Time to Live (TTL): TTL prevents data packets from being forwarded by routers indefinitely. It contains a counter that is set by the source. The counter is decremented by one as it passes through each router along its path. When the TTL counter reaches zero, the router currently holding the packet will discard the packet and return an ICMP Time Exceeded error message to the sender. 
  • Protocol: The protocol field tells the receiving device which protocol will be used for the data portion of the packet.
  • Header Checksum: The header checksum field contains a checksum that can be used to detect corruption of the IP header in transit. Corrupted packets are discarded.
  • Source IP Address: The source IP address is the IPv4 address of the sending device.
  • Destination IP Address: The destination IP address is the IPv4 address of the destination device.
  • Options: The options field allows for security options to be applied to the packet if the HLEN value is greater than five. The field communicates these options to the routing devices.

IPv6 packet#

IPv6 adoption has been increasing because of its large address space. There are eight fields in the header:

  • Version: This field indicates the IP version. For an IPv6 header, IPv6 is used.
  • Traffic Class: This field is similar to the IPv4 Type of Service field. The Traffic Class field provides information about the packet’s priority or class to help with packet delivery.
  • Flow Label: This field identifies the packets of a flow. A flow is the sequence of packets sent from a specific source. 
  • Payload Length: This field specifies the length of the data portion of the packet.
  • Next Header: This field indicates the type of header that follows the IPv6 header such as TCP.
  • Hop Limit: This field is similar to the IPv4 Time to Live field. The Hop Limit limits how long a packet can travel in a network before being discarded.
  • Source Address: This field specifies the source address of the sender.
  • Destination Address: This field specifies the destination address of the receiver.

https://en.wikipedia.org/wiki/Internet_Protocol