I am working on a project in which I need to add some options in the IPv4 header field. I am following this draft for the implementation. I have a doubt!

As the above mentioned draft says, I need to add atleast 32*5 = 160 bits to the header of IP packet but as far as I know the Options field in the IP header is only limited to 32 bits. How can I add options which have length more than 32bits? Also what should be the right approach for adding options if there are some options already present in the header!

Thank you!

  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 11, 2017 at 14:42

1 Answer 1


Both your questions can be answered by reading RFC 791 on the Internet Protocol.

First of all, where did you get that Options field size? An IPv4 header can contain up to 40 bytes (320 bits) of options.

The length of the IP header is indicated in the Internet Header Length (IHL) field. It uses 32 bit words as the unit of length, so the total size of the header is the value of IHL times 32 bits.

Since the IHL is a 4 bit field, the maximum value is 15. This results in a maximum header size of 15 x 32, or 480 bits.

A minimal IP header without options is 160 bits (IHL = 5). This leaves 480-160, or 320 bits for options.

As for your second question, the structure of the option field is not free, it should contain an option list as defined on RFC 791, page 15. If options are present, you should add yours behind them, at the end of the list.

  • Hey, Thanks a lot for quick answer! I checked the packet format on wikipedia. one more question: what if all options combined have size above 480 bits? How do I manage the options then? Mar 18, 2015 at 17:15
  • As far as I know, you are out of luck in that case. You will have to drop one or more of the options.
    – Gerben
    Mar 19, 2015 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.