I read in 2-3 places that length of IP header may change during transit from source to destination with routers in-between. However, no explanation was given as to why it might change.

According to me, the only way the length of IP header could change is when length of options field would change. For example, we have record route option where the IP address gets added each time to options field when it passes through each router giving us the entire route from source to destination. So here as IP address is added each time, the length of option field is changing.

Is this reasoning correct?

  • 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 can provide and accept your own answer.
    – Ron Maupin
    Feb 19, 2018 at 19:49

2 Answers 2


Yes. Only options change the length of the header.

  • But which option changes the length ?
    – Zephyr
    Oct 20, 2017 at 17:09
  • how will fragmentation change the IP header length ? Only the field value changes or fragmentation offset changes but the amount of bits allocated to fragmentation offset in IP header remains same. Only total length of datagram changes due to fragmentation and not IP header length.
    – Zephyr
    Oct 20, 2017 at 18:33
  • I deleted my previous comment: of course I should have said RFC 791, which replaced 760, and which differs materially in this specific detail. To answer the question, some options are copied to each fragment, some appear only in the first fragment. Some can be inserted or deleted for any reason. The options eg record route defined in 791 overwrite fields in the header rather than changing length as in 760. Nevertheless, routers have been known to drop source routing and similar options.
    – jonathanjo
    Oct 21, 2017 at 13:15

No, it doesn't change

The Header length or size is decided by the number of fields present inside the header like MF, TTL, etc. The fields are decided by the sender itself, routers cannot add or delete fields.

However, routers can change the contents of the fields e.g Record route will can have 0 to 9 IP addresses, but this will not change the length of it

  • 1
    There are a number of IP options that can be added to the header, changing its length - see RFC 791. Record Route is one of those options (and long obsolete).
    – Zac67
    Jan 22, 2022 at 12:44
  • 1
    if header length was constant why would anyone put header length field in the header? IPv6 header is constant and it does not have a header length field.
    – Effie
    Jan 22, 2022 at 14:38
  • @Zac67 Suppose the record route recorded 5 IP addresses, will the HL increase by say 5 units as compared to 0 addresses recorded?
    – Tushar
    Jan 22, 2022 at 15:07
  • 1
    The header length is determined by the value in the four-bit IHL field that is the number of 32-bit words in the header, and it can change if options change. The header is a minimum of 20 octets (IHL=5) and a maximum of 60 octets (IHL=15).
    – Ron Maupin
    Jan 22, 2022 at 15:16
  • @RonMaupin Is it possible for the options to change dynamically at the router if the user doesn't set them in the first place?
    – Tushar
    Jan 22, 2022 at 15:33

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.