Monday, June 23, 2014

IPv4 Datagram Options and Option Format

IPv4 Datagram Options and Option Format

All IP datagrams must include the standard 20-byte header,  the creators of IPv4 included the ability to add options that provide additional flexibility in how IP handles datagrams. 
The IP datagram may contain zero, one or more options, which makes the total length of the Options field in the IP header variable. Each of the options can be either a single byte long, or multiple bytes in length, depending on how much information the option needs to convey. When more than one option is included they are just concatenated together and put into the Options field as a whole. Since the IP header must be a multiple of 32 bits, a Padding field is included if the number of bits in all options together is not a multiple of 32 bits.
IP Option Format
Each IP option has its own subfield format, generally structured as shown in below table and picture. For most options, all three subfields are used: Option TypeOption Length and Option Data

Internet Protocol Version 4 (IPv4) Option Format
Subfield Name
Size (bytes)
Description
Option Type
1

Option Length
0 or 1
Option Length: For variable-length options, indicates the size of the entire option, including all three subfields shown here, in bytes.
Option Data
0 or Variable
Option Data: For variable-length options, contains data to be sent as part of the option.

 Internet Protocol Version 4 (IPv4) Option Format

* Copied --> Fragments (1 or 0 ) (1 bit)
* Option Class --> 0: Control 2: Debug (2bits)
* Option Number --> 32 different of value can be assigned. 

Below table lists the most common IPv4 options, showing the option class, option number and length for each (a length of 1 indicating an option that consists of only an Option Type field), and providing a brief description of how each is used.

Table 59: Internet Protocol Version 4 (IPv4) Options
Option Class
Option Number
Length (bytes)
Option Name
Description
0
0
1
End Of Options List
An option containing just a single zero byte, used to mark the end of a list of options.
0
1
1
No Operation
A “dummy option” used as “internal padding” to align certain options on a 32-bit boundary when required.
0
2
11
Security
An option provided for the military to indicate the security classification of IP datagrams.
0
3
Variable
Loose Source Route
One of two options for source routing of IP datagrams. See below for an explanation.
0
7
Variable
Record Route
This option allows the route used by a datagram to be recorded within the header for the datagram itself. If a source device sends a datagram with this option in it, each router that “handles” the datagram adds its IP address to this option. The recipient can then extract the list of IP addresses to see the route taken by the datagram.

Note that the length of this option is set by the originating device. It cannot be enlarged as the datagram is routed, and if it “fills up” before it arrives at its destination, only a partial route will be recorded.
0
9
Variable
Strict Source Route
One of two options for source routing of IP datagrams. See below for an explanation.
2
4
Variable
Timestamp
This option is similar to the Record Route option. However, instead of each device that handles the datagram inserting its IP address into the option, it puts in a timestamp, so the recipient can see how long it took for the datagram to travel between routers.

As with the Record Route option, the length of this option is set by the originating device and cannot be enlarged by intermediate devices.
2
18
12
Traceroute
Used in the enhanced implementation of the traceroute utility, as described in RFC 1393. Also see the topic on the ICMP Traceroute messages.


Please find the list in this PAGE to see all the options.

Each IP option has its own subfield format, generally structured as shown in below table and picture. For most options, all three subfields are used: Option Type, Option Length and Option Data. 

IP Options and Source Routing
In some cases,  the source of a datagram may specify the route a datagram takes through the network. This is called source routing.
There are two IP options that support source routing. In each, the option includes a list of IP addresses specifying the routers that must be used, to reach the destination. When strict source routing is used, this means that the path specified in the option must be used exactly, in sequence, with no other routers permitted to handle the datagram at all. In contrast, loose source routing specifies a list of IP addresses that must be followed in sequence, but having intervening hops in between the devices on the list is allowed.

* This is from http://www.tcpipguide.com/free/t_IPDatagramOptionsandOptionFormat-3.htm

6 comments: