MSS & MTU
Smallest Network Packet
MSS (Maximum Segment Size):
- The largest TCP segment size that a network connected device can receive.
- Only the payload size, not including header
- Agreed on TCP handshake.
- Layer 4
MTU (Maximum Transmission Unit):
- The largest data packet that a network-connected device will accept.
- Layer 3
- Include TCP and IP headers.
- Fragmentation: All network routers check the size of each IP packet they receive against the MTU of the next router that will receive the packet. If the packet exceeds the MTU of the next router, the first router breaks the payload into two or more packets, each with its own headers.
One of the key differences between MTU and MSS is that if a packet exceeds a device’s MTU, it is broken up into smaller pieces, or “fragmented.” In contrast, if a packet exceeds the MSS, it is dropped and not delivered.
When is fragmentation not possible?
In certain cases, packets cannot be fragmented, and therefore they will not be delivered if they exceed the MTU of any router or device along the network path:
- Fragmentation is not permitted in IPv6. IPv6 is the latest version of the Internet Protocol, although IPv4 is still widely used. Routers that support IPv6 will drop any IPv6 packets that exceed the MTU, because they cannot be fragmented.
- Fragmentation is also not possible when the “Don’t Fragment” flag is activated in a packet’s IP header.
IPv6: For IPv6, which does not allow fragmentation, PMTUD works in much the same way. The key difference is that IPv6 headers do not have the Don’t Fragment option and so the flag is not set. Routers that support IPv6 will not fragment IPv6 packets, so if the test packets exceed the MTU, the routers drop the packets and send back corresponding ICMP messages without checking for a Don’t Fragment flag. IPv6 PMTUD sends smaller and smaller test packets until the packets can traverse the entire network path, just like in IPv4.
Path MTU discovery
When a packet is dropped, the router sends back ICMP messages to the origin.