49

I'm confused as to the difference between maximum segment size and a maximum transmission unit.

Can someone please explain in relation to layers 2 and 3?

If I had a packet of 800 bytes in the payload. Would it be correct to say that the MSS would be 800 bytes (If I set it to be that) and the MTU would be 840? TCP 20 and IP 20 bytes. Would it be any different if I was doing PPPoE?

1

3 Answers 3

27

In addition, MSS value is derived from the MTU. Consider that you have data of 2260 bytes to be sent to a remote device. If MTU is 1500, and we consider IP header + TCP header to be 40 bytes, then only 1460 bytes of data can be sent in the first IP packet. The remaining 800 bytes will be sent in the second IP packet. So, for MSS = 800, the MTU should be at least 840.

As PPPoE overhead is 8 bytes, and therefore MTU = 1492 bytes, and MSS = 1492-40 = 1452 bytes.

39

The MTU is the Maximum IP packet size for a given link. Packets bigger than the MTU is fragmented at the point where the lower MTU is found and reassembled further down the chain.

If no fragmentation is wanted, either you have to check the MTU at each hop or use a helper protocol for that (Path MTU Discovery).

Note that IPv6 does NOT support packet fragmentation by routers, hence PMTUD with ICMPv6 is mandatory if you don't want to lose a packet somewhere because of small MTU. Endpoints can fragment, but not routers Also, IPv6 has a much higher MINIMUM MTU.

MSS is Maximum TCP segment Size. Unlike MTU, packet exceeding MSS aren't fragmented, they're simply discarded. MSS is normally decided in the TCP three-way handshake, but some setup might yield path where the decided upon MSS is still too big, leading to dropped packets. The MSS isn't negotiated packet per packet, but for a complete TCP session, nor does it take into account TCP/IP headers

When using PPPoE, all the overhead means you needs to reduce the MSS on the way, normally by specifying it on the router where the chokepoint is found, which will then replace the MSS of passing threeway handshake by the correct lower value if it's higher. PPPoE is simply adding 8 bytes (6 bytes PPPoE + 2 bytes PPP) on top of everything (IP+TCP) and is meant to be run over Ethernet at 1500 bytes MTU, hence the 1492 MSS normally configured to make it go through.

Your IP stack will chop off data to be sent up to the MSS, put it in a TCP segment, then put it in one or more IP packets (depending if it's bigger than local MTU settings) before sending it. Intermediate router could chop it down further if they have lower MTU, but they're only affecting the IP Packet itself, not playing into the TCP segment/header.

3
  • 4
    Clatification: IPv6 doesn't support fragmentation in routers however end stations may fragment IPv6 packets Commented Jun 8, 2014 at 17:24
  • 1
    Edited my answer to be more specific Commented Jun 8, 2014 at 23:26
  • Small clarification since its a common misconception " reassembled further down the chain" is actually : "reassembled at the destination host".
    – JFL
    Commented Apr 21, 2021 at 9:52
2

MTU is maximum IP packet size of a given link. MSS is Maximum TCP segment size.

MTU is used for fragmentation i.e packet larger than MTU is fragmented.But in case of MSS, packet larger than MSS is discarded.

MSS is specified during TCP handshake basically in SYN and its value can't be changed after the connection is established.

MSS=MTU-40(IP header(20 bytes) + TCP header(20 bytes) )

2
  • 1
    I think TCP header is not necessarily 20 bytes, that's just the minimal length?
    – Sajuuk
    Commented Jul 1, 2019 at 8:09
  • 1
    there could be an additional options header Commented Jul 25, 2019 at 14:19

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