3

If I have ComputerA that has their networking interface set with an MTU of 1500 and ComputerB has a network interface with an MTU of 1200 is there any way for ComputerA to know that ComputerB's MTU is 1200 or if it sends large packets it will get from ComputerB a request to fragment the packet?

3
  • 1
    Possible duplicate of What does MTU depend on?
    – Zac67
    Commented Jul 2, 2019 at 9:40
  • @Zac67 That talks about the protocol but does not answer my question. Commented Jul 2, 2019 at 10:13
  • 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
    Commented Dec 15, 2019 at 4:36

2 Answers 2

10

The hosts can use Path MTU Discovery which is optional for IPv4 and mandatory for IPv6.

With IPv4, a packet is fragmented where it is larger than the egress interface's MTU - that can happen on the source host or any intermediate router. In your example, the router between A and B would fragment the packet.

Fragmentation can put considerable load on routers and was removed for IPv6 routers, so a v6 host needs to discover the path MTU for each destination or fragment oversized packets by itself. If an IPv6 router encounters an oversized packets it returns an ICMP error and drops it.

The MTU is a property of each interface. It is either (hardware) default, configured statically, or by DHCP (option 26). All nodes in a shared L2 segment need to use the same maximum frame size, resulting in the same MTU. If a node sends larger frames than the others can except these are dropped as oversized.

3
  • 2
    PMTUd only works where there's a router between the mismatch. It does nothing on-link -- a packet larger than MTU is an error (oversized) and dropped without the OS even knowing about it.
    – Ricky
    Commented Jul 2, 2019 at 15:06
  • 1
    IPv6 also has fragmentation. However, it's the job of the end-points to do the framenting, vs. the IPv4 process of the router-in-the-middle doing it.
    – Ricky
    Commented Jul 2, 2019 at 15:08
  • @RickyBeam All hosts in a common L2 segment need to use the same MTU. If they differ, packets are lost, as you've said. Re fragmentation: you're correct, of course - added, thx.
    – Zac67
    Commented Jul 2, 2019 at 15:20
2

This is a bit of a sideline answer, as the question was about MTU, not MSS.

... and then there's TCP MSS, which helps in case of TCP, but of course not with UDP nor ICMP.

Using the MSS field in the TCP header (only in the SYN and SYN-ACK packets of the initial 3-way handshake), hosts can signal to their peers how large a TCP payload is acceptable to receive.

TCP MSS negotiation can be a blessing, but also a nuisance, as it helps to hide MTU problems until something with large UDP packets comes along and fails at the "all hosts on the common L2 segment need to use the same MTU" criterium (see Zac67's comment, above)

A host will derive the MSS from the MTU of the given egress interface used to communicate with the given peer. Usually, values of MTU-40 are seen (1460 for common ethernet), or even less if TCP timestamping is being used.

TCP MSS is a property of the given TCP session/socket; a jumbo frame enabled host will happily exchange TCP segments with a peer which has 1460bytes MSS just as well as one with 1160 bytes, while talking to the a backend system with an MSS of 8960 bytes, all simultaneously on the same single interface.

If the network path between the TCP speakers has tunneling features (such as an IPsec site2site-tunnel), routers, gateways or firewalls will often manipulate the TCP MSS field in the initial packets of a TCP session (usually to something like 1350 bytes); this is known as "mss clamping" or "adjust-mss", to make the end systems believe that the reciprocal remote peer could not receive larger packets, which would not fit through the tunnel without fragmentation (of course, if a host signals an MSS lower than the clamping value, the device will leave the lower value as it is)

2
  • 1
    ... and MSS negotiation miserably fails when a link in between has a lower MTU and doesn't clamp. This is probably one of the reasons to make pMTU discovery mandatory and do away with all the patchwork.
    – Zac67
    Commented Jul 2, 2019 at 16:36
  • @zac67- you certainyl have a point there. However, I'd rather strive for proper MSS clamping implementation than to hope that end hosts, together with multi-level-encapsulating router cascades being hampered by icmp-averse firewall admins will eventually get PMDUd right... Commented Jul 2, 2019 at 17:24

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