IPV4 Header Field
IPV4 Header
Version (4 bits):
• This field is straightforward. It ensures that routers and devices can
correctly interpret the header format. With IPv4, the value is always
0100 (binary) or 4 (decimal).
• This field allows for future IP versions (like IPv6) to coexist on
networks. Without it, devices wouldn't know how to parse the
header.
Internet Header Length (IHL) (4 bits):
•Detail: This field specifies the size of the header itself, not the entire packet.
It's measured in 32-bit words. Since the base header is 20 bytes (5 x 32 bits),
the minimum value is 0101 (5). The maximum is 1111 (15), indicating a 60-byte header (15 x 32 bits).
The extra 40 bytes are for options.
•Example:
•If a packet has no options, IHL = 5 (20 bytes).
•If a packet uses the "record route" option, the IHL will be greater than 5.
•Importance: This field lets the receiving device know where the header ends and the data payload begins.
Differentiated Services (DS) Field (8 bits):
• Detail: This field is crucial for QoS. It's subdivided:
• DSCP (Differentiated Services Code Point) (6 bits): Defines the priority of the packet. Values are standardized to
indicate different traffic classes (e.g., expedited forwarding for VoIP, assured forwarding for various levels of
priority).
• ECN (Explicit Congestion Notification) (2 bits): Allows routers to signal congestion to the endpoints without
dropping packets.
• Examples:
• A VoIP packet might use a DSCP value that prioritizes it for low latency.
• A file transfer might use a lower-priority DSCP value.
• Routers that are experiencing congestion can set the ECN bits, so that the sending computer can slow down its
transmission rate.
• Relevance: Vital for real-time applications and managing network congestion.
Total Length (16 bits):
• Detail: This field specifies the total size of the IP packet (header +
data) in bytes. The maximum value is 65,535 bytes (2^16 - 1).
• Example: If a packet has a 20-byte header and 1,480 bytes of data,
the total length is 1,500 bytes.
• Necessity: This field allows the receiving device to know the complete
size of the packet.
Identification (16 bits), Flags (3 bits), and
Fragment Offset (13 bits):
• Detail: These fields are essential for IP fragmentation:
• Identification: A unique value assigned to each packet, used to reassemble fragments.
• Flags:
• Reserved (1 bit): Must be 0.
• DF (Don't Fragment): If set, the packet cannot be fragmented.
• MF (More Fragments): If set, it means more fragments follow.
• Fragment Offset: The position of the fragment's data relative to the original packet's
data, measured in 8-byte blocks.
Identification (16 bits), Flags (3 bits), and Fragment
Offset (13 bits):
• Example:
• A 4,000-byte packet needs to be sent over a network with a maximum transmission unit (MTU)
of 1,500 bytes.
• It's fragmented into three packets.
• Each fragment has the same Identification value.
• The MF flag is set in the first two fragments.
• The fragment offset field allows the recieving host to reassemble the packets in the correct
order.
• Function: Allows large packets to traverse networks with smaller MTUs.
Time to Live (TTL) (8 bits):
• Detail: This field prevents packets from circulating indefinitely. Each router
decrements the TTL by 1. When it reaches 0, the packet is discarded, and
an ICMP "time exceeded" message is sent back to the source.
• Example: A packet starts with a TTL of 64. If it passes through 10 routers,
the TTL will be 54.
• Purpose: Prevents routing loops from consuming network resources.
Protocol (8 bits):
• Detail: This field indicates the next-level protocol within the packet's data payload.
Common values include:
• 6: TCP
• 17: UDP
• 1: ICMP
• Example: If the protocol field is 6, the data payload contains a TCP segment.
• Importance: Enables demultiplexing at the receiving host, directing the data to the
correct application.
Header Checksum (16 bits):
• Detail: A simple error-detection mechanism. The sender calculates the checksum
and inserts it into the header. The receiver recalculates the checksum and compares
it to the received value. If they don't match, the packet is discarded. It only checks
the header, not the data.
• Limitation: It is not a very robust error detection method, and higher level protocols
such as TCP and UDP also implement their own checksums.
• Function: Ensures the integrity of the header.
Source Address (32 bits) and
Destination Address (32 bits):
•Detail: These fields contain the IP addresses of the sender and receiver, respectively.
•Example: 192.168.1.10 (source) and 8.8.8.8 (destination).
•Fundamental: Essential for routing packets to the correct destination.
Options (variable):
• Detail: These are optional fields that allow for extended functionality. They can
include:
• Record Route: Records the path a packet takes.
• Strict Source Routing: Forces a packet to follow a specific route.
• Loose Source Routing: Specifies a set of routers that the packet must pass through.
• Security options.
• Example: The "record route" option can be used for network troubleshooting.
• Usage: Used for specialized network tasks.