Where is the Don't Fragment Bit of the IP Flags used?

前端 未结 3 2058
醉梦人生
醉梦人生 2021-02-08 16:07

I am curious to know where the \"Don\'t Fragment\" [DF] Bit of the IP Flags is used. As fragmentation is invisible to higher layers and they don\'t care too.

I am also l

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 16:33

    In addition to @Pax's answer (or perhaps as part of the testing he mentioned), the DP flag is also used in path MTU discovery. This is when you try to figure out what the largest packet that can be sent without being fragmented is, for a given link.

    It is often useful to avoid fragmentation, even though higher-level protocols are in theory isolated from the mechanics of it, they can still "feel" the consequences. If a single application-level write() to the network socket ends up being fragmented because it is too large, and one of the fragments is lost in the network, the entire IP packet will be lost. This of course affects throughput.

    For this reason, it is often desirable to know the maximum transmission unit, i.e. the largest packet that can be sent to a destination without being fragmented. Path MTU discovery is used to find this size, by simply setting the DF bit and sending successively larger packets until the network reports (over ICMP) a failure.

提交回复
热议问题