In-depth understanding of Linux Network Technology insider--IP options handling

Source: Internet
Author: User

IP Options Introduction

The IP header has 4bit for the first Minister, whose unit is 4 bytes, so the maximum length of the IP header is 15*4=60 bytes (4bit can be represented to the maximum), and the length of the IP fixed header is 20 bytes, Therefore, an IP header is allowed with an option of 40 bytes length.

IP options are available in two formats, single-byte and multi-byte


For multibyte options, the length is identified by the long field, and the Optiondata does not start at the 32bit boundary.

Length field

Option length, including type and length

Pointer field

The offset from the beginning of the option, with some special purposes , with an initial value of 1 (not 0)


Type field

Each IP option contains a type field of 8bit, which can be further divided into three fields:


If the copied field is set, the field is copied to each segment when the data message needs to be segmented.

The class field is categorized according to the four guideline sub-options.

Macro ipopt_copied, Ipopt_class, Ipopt_number can remove fields COPIED, CLASS, and number respectively.




End of option list//when the size of the IP option is not a multiple of 4 bytes, the carrier uses the Ipopt_end (the symbol used in the kernel source for the END of the option list) option as the IP header filler to align the 4-byte boundary. The No operation//can be used to fill gaps between options, for example, to align specific boundaries for subsequent IP options. The Source route//contains the router address that is used for subsequent hops. When the router goes down, the higher-level protocol calculates a new source route and then re-sends the packet. Source routing consists of two types://⑴ Strict (Strict source route): The carrier must list the IP address of each router on the path, and cannot be modified along the way, and must be routed to the routing address on the list. ⑵ Loose (Loose Source route): During routing, an intermediate route can use another router (no longer in the list) as the path to the next router in the list. The Record route//is the IP address of the outgoing interface that the router between the requesting sender and destination stores when they use to forward the packet. Timestamp: There are three types of//subtype://⑴record timestamps: Each router logs the time it received the packet. ⑵record address and timestamps: similar to the previous command, but also stores the IP address of the receiving interface. ⑶record timestamps only at the prespecified SYSTEMS: Each router will record the receive time when it receives the packet, but only for some specific IP addresses selected by the carrier. Router alter//to mark the packet as requiring special handling, and he tried to establish better QoS for packet traffic.

End of Option Listand no Operation options

The size of the IP header without options is 20 bytes. Ipopt_end fillers must be used when the size of the IP header is not 20 bytes.

The Ipopt_noop is used to fill the gap between options that are caused by aligning the 4-byte boundary.

Source Route Options

The source route is a multi-word excerpt. In this option, the Send node lists the IP addresses of the subsequent hops (cannot exceed the maximum length of the IP header). If a host in the list is down, you must recalculate the source route and resend it instead of using dynamic routing.

Source route is divided into strict source route strict source route and loose source route loose Source route

Strict Source Route:

List the IP addresses of each route you need to pass along the way, and not modify them along the way

Loose Source Route

One of the routes in the middle, you can use another route that is no longer in the list to pass the message to the next one in the list.     If the list is a->b->c->d, for the loose Source route, B can pass the datagram to C by no longer a route in the list, such as F. That is a->b->f (not in the list)->c->d

Record Route Options

Save the routed IP address of the message (up to 9, 9 before saving).

Timestamp options

The fourth byte is divided into the overflow subfield and the subtype sub-field.

In message transmission, whenever the IP option overflows (more than 40 bytes), overflow plus one, because the overflow itself overflows (greater than 15 when this option overflows), because an ICMP packet is sent each time the overflow overflows.

There are three types of subtype:
⑴record timestamps: Each router logs the time it receives the packet.
⑵record address and timestamps: similar to the previous command, but also stores the IP address of the receiving interface.
⑶record timestamps only at the prespecified SYSTEMS: Each router will record the receive time when it receives the packet, but only for some specific IP addresses selected by the carrier.


Router Alert optionmarking the packet as requiring special handling, he attempts to establish better QoS for packet traffic.



Some important functions of IP options for handling IP options


Process of IP options








In-depth understanding of Linux Network Technology insider--IP options handling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.