Segmentation vs fragmentation

Unanswered Question
Mar 24th, 2008

I'm interested to know whether it exists a case when the TCP MSS (Maximum Segment Size) is greater than MTU - 40bytes (40bytes comes from IP header of 20bytes + TCP header of 20bytes).

Or with another words could we set MSS independently from MTU? Or MSS is automatically re-computed according to the MTU (and maybe some other parameters, which I don't consider them in this discussion, though if you have the detailed algorithm, you're welcome to share it).

If we could set MSS higher than MTU-40bytes, then it means that the TCP segments passed towards IP layer would be grater than MTU-20bytes, and so the IP packets would be greater than MTU (MTU-20bytes+20bytes), hence they would be fragmented by IP layer (supposing fragmentation is not forbidden of course).

My understanding is that TCP takes care to perform the segmentation according to MSS=MTU-40bytes so that no IP fragmentation will be needed to be performed by IP layer afterwards.

Am I correct? Or there could be cases where we have "simultaneously" segmentation and fragmentation ?

To sum up, my current understanding is that:

a) In case UDP is used at transport layer, then we could have only fragmentation at Network layer, but no segmentation at Transport Layer

b) In case TCP is used at transport layer, we could have only segmentation at Transport Layer, but no fragmentation at Network Layer.

Thanks for any brainstorming around this topic.

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
padramas Mon, 03/24/2008 - 12:34

Hi,

a) In case UDP is used at transport layer, then we could have only fragmentation at Network layer, but no segmentation at Transport Layer

Application read/write forms the UDP data and it is directly attached to fragmentation.

b) In case TCP is used at transport layer, we could have only segmentation at Transport Layer, but no fragmentation at Network Layer.

first of all, MSS is not a negotiated parameter. It is announced by sender/receiver on SYNC pkt indicating the amount of data it can receive on a single segment. So, for a host it avoids fragmentation on the directly attached segment. However, if the pkt has to traverse through multiple network segments with lower MTU values,it will be fragmented at the network boundary.

HTH

Padmanabhan

badalam_nt Tue, 03/25/2008 - 01:42

Thanks for your reply.

So if my understanding was correct then:

a)In case UDP is used at transport layer,

you meant that the application itself will take care to deliver to UDP layer data with a length not higher than MTU-28bytes (28bytes comes from UDP header of 8bytes + IP header of 20bytes), so that the host is not put in the situation to fragment at its Network layer the datagram passed down by UDP towards the IP.

b)In case TCP is used at transport layer, a host will NEVER announce an MSS greater than its MTU-40bytes.

Am I right?

shrikar.dange Tue, 03/25/2008 - 02:13

Hi,

I think you are misinterpriting the term "MTU".In my knowledge interpretation of MTU is that it is the maximum data encapsulated inside an L2 frame.Means, if we remove the L2 header and trailer from the L2 frame, the remaining bytes is the MTU.

While a TCP segment is basically the TCP header plus the data that's right behind it. the data belongs to the upper layers (5,6,7).

HTH,

regards,

shri :)

badalam_nt Tue, 03/25/2008 - 06:58

Shri, actually you're discussing something outside the topic.

Anyway, no problem for me, but I couldn't figure out how you deduced that we're misinterpreting the MTU ???

padramas Tue, 03/25/2008 - 19:06

Generally yes, application has to take care of the payload handed over to UDP as it is unaware of the MTU.

Also application read/write can be different from TCP segment size. If it is greater,TCP performs segmentation to accommodate maximum chunk of data in a given segment(i.e. MSS).

As said in my previous post MSS is not announced by host/application. It is a TCP parameter which is exchanged by sender/receiver on the SYN packet during connection establishment.

HTH

Padmanabhan

shrikar.dange Tue, 03/25/2008 - 21:40

Hi,

I think I have misunderstood what you are trying to say.Are saying that MSS = MTU "MINUS" header bytes? Well then sincere appologies for that.I was assuming that you are talking about "MINIMUM" MTU without any payload.

Each device sends the other the MSS that it wants to use for the connection, if it wishes to use a non-default value. When receiving the SYN, the server records the MSS value that the client sent, and will never send a segment larger than that value to the client. The client does the same for the server. The client and server MSS values are independent, so a connection can be established where the client can receive larger segments than the server or vice-versa.

UDP does not provide any mechanism to manage the flow of data between devices, or handle congestion.UDP's only real task is to take data from higher-layer protocols and place it in UDP messages, which are then passed down to the Internet Protocol for transmission.

HTH,

regards,

shri

badalam_nt Wed, 03/26/2008 - 04:20

Finally thanks to both you I'm getting a better picture, though still one last detail I need to get it clarified.

For UDP it is clear.

For TCP we could have the following cases:

Let's take as example 2 hosts, each having one Ethernet interface only, connected through an L2 switch. Suppose that the MTU for Host1 is set to 1500 bytes and for Host2 is set to 1400 bytes (with TCP Optimizer for instance). Also consider that fragmentation is not forbidden.

The MSS sent by TCP layer of Host1 inside the SYN message will be 1460bytes?

And the MSS sent by TCP layer of Host2 will be 1360bytes?

If so, then this would mean that:

a) For direction Host1 -> Host2:

the TCP layer of Host1 will pass down to its IP layer TCP segments with size of 1360bytes+20bytes=1380bytes.

At the other end in Host2 the IP layer will pass upwards to its TCP layer the TCP segment with a size of 1380 bytes.

So for the direction Host1 -> Host2 there will be no fragmentation inside the IP layer of Host1, nor any re-assembling inside the IP layer of Host2.

b) For direction Host2 -> Host1:

the TCP layer of Host2 will pass down to its IP layer TCP segments with size of 1460bytes+20bytes of TCP header=1480bytes.

Because this is greater than the 1380bytes limit (1400bytes-20bytes for IP header=1380bytes), the IP layer of Host2 will fragment the TCP segment that was passed down by its TCP layer into 2 IP packets: one IP packet with the size of 1400bytes and a second one with the size of 120bytes.

At the other end in Host1 the IP layer will receive 2 IP packets, will re-assemble them and it will pass upwards to its TCP layer the TCP segment with a size of 1480 bytes.

So for the direction Host2 -> Host1 there will be fragmentation inside the IP layer of Host2 and re-assembling inside the IP layer of Host1.

Is my understanding correct?

badalam_nt Wed, 04/02/2008 - 03:36

By reading the TCP/IP Illustrated book, I draw the conclusion that the case:

b) For direction Host2 -> Host1:

containing my assumptions based on your explanations, is not correct.

The TCP layer of Host2 will in fact pass down to its IP layer TCP segments with size of 1380bytes, which represents the minimum value between (1460bytes+20bytes of TCP header=1480bytes) and (MTU for Host2 - 20bytes of IP header = 1380bytes).

Because this is NOT greater than the 1380bytes limit (1400bytes-20bytes for IP header=1380bytes), the IP layer of Host2 will not fragment the TCP segment that was passed down by its TCP layer.

At the other end in Host1 the IP layer will receive the IP packet and it will pass upwards to its TCP layer the TCP segment with a size of 1380 bytes.

So for the direction Host2 -> Host1 there will be also NO fragmentation inside the IP layer of Host2 and NO re-assembling inside the IP layer of Host1.

So it comes to my original understanding that there will be no fragmentation in case we use TCP, for this example. (as for other cases, with intermediate routers where MTU would be lower than 1400bytes, and also considering that the Don't Fragment bit is not set, then fragmentation would occur.

So with this contradictory information, I'm not sure which is the right behavior.

Could someone tell me actually which is the right scenario for the given example ?

Actions

This Discussion