- In addition to the standard 20-byte IP header, IP options provide more flexibility in how the datagrams are handled.
- IPv4 options are, unsurprisingly, optional. However, all IP devices must be capable of properly reading and handling them.
- The IP datagram may contain zero, one or more options.
- This makes the IP header variable in size. Since the IP header must be a multiple of 32 bits, a Padding field is included if all options together is not a multiple of 32 bits.
IP Option Format
- Option Type: This 8-bit field is divided into three sub-fields.
- Copied (1-bit flag): 1 if the option is to be copied into all fragments; 0 if the option should not be copied.
- Option Class (2 bits): Only two values are used - 0 is for Control options, and 2 for Debugging and Measurement.
- Option Number (5 bits): Specifies the kind of option. 32 different values can be specified for each of the two option classes.
- Option Length: Indicates the size of the entire option in bytes.
- Option Data: Contains data to be sent as part of the option.
List of IPv4 Options
ReferencesTCP/IP Guide: IP Option Format
TCP/IP Guide: IP Options
IPv6 Extension Headers
- Much like IPv4 options, IPv6 extension headers carry optional information.
- Rather than a single variable header that contains all fields (including options), the IPv6 datagram consists of the main header and the extension headers.
- Only the fields that are truly required for all datagrams remain in the main header; others are put into extension headers and are used as needed.
| Main Header (40 bytes) |
| Extension Header #1 |
| ... |
| Extension Header #N |
| Data |
- The only field in common to all extension headers is the Next Header field, which logically links all the headers in the IPv6 together.
- The Next Header field in the main header contains a reference number for the first extension header type.
- The Next Header field in the first extension header contains the number of the second extension header type. The second header's Next Header points to the third one, and so on.
- The Next Header field of the last extension header contains the protocol number of the encapsulated higher-layer protocol.
- If there are no extension headers, the Next Header field points straight to the upper-layer protocol in the Data field.
List of Extension Headers
ReferencesTCP/IP Guide: IPv6 Header Chaining Using the Next Header Field
TCP/IP Guide: Summary of IPv6 Extension Headers
Bonus: IPv4 Header vs. IPv6 Header
Cisco: IPv6 Extension Headers Review and Considerations