Options Field in IPv4 Header


IPv4 is used for network communication. Data packets contain important info. The IPv4 header includes an options field for flexibility and control. The options field is optional and located between header length and type of service. Its presence depends on the value in the header length field.

Options Field in IPv4 Header

IPv4 header contains information about the source and destination of an IP packet. It also has other parameters that affect how packets are processed by routers and hosts. It consists of a fixed part of 20 bytes, followed by an optional part of up to 40 bytes. Optional part, known as options field, is variable in length and can contain zero, one, or more options. Although it can range from 0 to 40 bytes, options field is typically much shorter.

The options field in the IPv4 header provides additional functionality or flexibility to IP protocol. It can include different types of options, each serving a specific purpose. These options can provide various functionalities, i.e., routing control, security measures, and network diagnostics. Variable length of the options field customize of IP packets based on specific requirements or desired features.

Options field in IPv4 header is a part of information sent along with an IP packet. It helps control how packet is handled. This field can vary in length and is optional, which means it might not be included in all packets.

Format of IPv4 Options

In the IPv4 header, each option has a specific format. Options consist of three fields: type, length, and data. The type field indicates the option's specific type. It may have subfields: "copied" and "class." The length field shows the option's total length in bytes. Option data contains the actual parameters, format varies by type. Options field can serve other purposes, like indicating packet version or security. Most options aren't used in normal situations, but offer customization when needed.

Note

  • The maximum length of the Options field is 40 bytes.

  • The options are processed in order, from the beginning of the Options field to the end.

  • If an option is not recognized, it is ignored.

  • The Options field is not used for IPv6 datagrams.

Types of Options

First byte is the type of service and the second is the length in each option field. We have summarized the types of options defined in RFC 791 and RFC 1108.

Option Type Name Meaning
0 End of Option List (EOL) Indicates the end of the options field
1 No Operation (NOP) Used for padding or alignment purposes
2 Security Carries security information such as classification level
3 Loose Source and Record Route (LSRR) Allows the source to specify a list of intermediate nodes that the packet must visit
4 Stream Identifier Used for experimental purposes
5 Strict Source and Record Route (SSRR) Similar to LSRR, but requires the packet to visit only the nodes specified by the source
6 Experimental Measurement Used for experimental purposes
7 Record Route (RR) Records the IP addresses of the routers that process the packet
8 Stream Identifier Used for experimental purposes
9 Experimental Measurement Used for experimental purposes
10-16 Unassigned Reserved for future use
17-18 Experimental Access Control Used for experimental purposes
19-126 Unassigned Reserved for future use
127-130 Reserved for Security Option Expansion Reserved for future use
131-136 Unassigned Reserved for future use
137-138 Experimental Access Control Expansion Used for experimental purposes
139-140 IMI Traffic Descriptor (IMITD) Used for experimental purposes
141-252 Unassigned Reserved for future use
253-254 Experimentation and Testing (EXP) Used for experimental purposes

These options are explained below.

Record Route (RR)

This option records up to nine router IP addresses along the path from source to destination. It helps with debugging and tracing. The format includes type 7, copied bit 0, class 0 (control), and variable option length. The pointer field (1 byte) shows the next available slot for recording IP addresses. Source initializes it to 4, and each router increments it by 4. The route data field holds the router IP addresses in processing order. Unused slots are filled with zeros.

Source Routing (LSRR and SSRR)

Source routing options let the source set intermediate nodes for the packet's path. There are two types: loose source and record route (LSRR), and strict source and record route (SSRR).

LSRR allows additional nodes, SSRR follows only specified nodes.

There are two types: LSRR (3) and SSRR (5) options. Copied bit is 1, class is 0 (control), and option length varies. The pointer field (1 byte) shows the next node to visit. Source initializes it to 4, and each node increments it by 4. Route data field contains IP addresses of nodes to be visited. The first address is the first node to visit, and the last address is the final destination.

Security

This option carries security info for special handling of packets. Type is 2, copied bit is 1, class is 2 (reserved), option length is 11 bytes. The security field (2 bytes) shows packet classification level. Four levels: unclassified, confidential, secret, and top secret. Compartmentation field (4 bytes) has additional restrictions on access to information. Handling restrictions field (4 bytes) has further dissemination restrictions. Transmission control code (1 byte) controls access to information.

Padding

If an option isn't a multiple of 4 bytes, padding options fill it. Padding options: EOL (0) indicates end, NOP (1) is for alignment. For example, if an option is 7 bytes, a NOP (1) will make it 8 bytes. If there are no more options, EOL (0) marks the end.

End of Option List (EOL)

Marks end of options field, one byte with no data.

No Operation (NOP)

Used for padding or alignment, one byte with no data.

Stream Identifier

Identifies datagram stream, four bytes with two bytes of data.

Experimental Measurement

Measures network performance, variable length with at least three bytes.

Unassigned

Reserved for future use, no defined format or meaning.

Experimental Access Control

For access control based on criteria, variable length with at least three bytes.

Experimental Access Control Expansion

For access control based on criteria, variable length with at least three bytes.

IMI Traffic Descriptor (IMITD)

Describes datagram traffic characteristics, variable length with at least three bytes.

Experimentation and Testing (EXP)

Used for testing new features or protocols, variable length with at least three bytes.

Summary

The Options field in the IPv4 header provides additional functionality and flexibility to the protocol. It includes various control parameters and additional information about the packet. The options field is located between the header length and the type of service fields. Its presence is determined by the value in the header length field.

The options field can contain different types of options. Each serving a specific purpose. These options provide functionalities. These are routing control, security measures, and network diagnostics. The format of each option includes the option type, option length, and option data fields.

While the options field offers customization and flexibility. Most of its features are not needed in normal situations. Therefore, it is rarely used. However, having the options field available allows for customization and flexibility when specific needs arise.

It's important to note that the maximum length of the options field is 40 bytes. The Options are processed in order from the beginning to the end of the field. Unrecognized options are ignored. The options field is not used for IPv6 datagrams.

Overall, the options field in the IPv4 header enhances the functionality of the IP protocol. It provides additional control over how IP packets are processed.

Updated on: 31-Aug-2023

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements