cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
23305
Views
0
Helpful
17
Replies

Understanding MTU, MSS, Frame / Packets / TCP and UDP - From a beginner perspective (confused)

SJ K
Level 5
Level 5

Hi all,

I have read around extensively but i am still not able to grasp the actual relationship of the above.

 

MTU

1st and foremost, the description of MTU in TCP/IP guide is ->

The data link layer implementation puts the entire IP datagram into the data portion (the payload) of its frame format, just as IP puts transport layer messages, transport headers and all, into its IP Data field. This immediately presents us with a potential issue: matching the size of the IP datagram to the size of the underlying data link layer frame size.
The IP implementation of all devices on an IP internet needs to be aware of the capacity of the technology used by that implementation for its immediate data link layer connection to other devices. This limit is called the maximum transmission unit (MTU) of the network

In another word to my understanding, MTU is the size of the payload in a layer 2 frame -- please let me know if i am wrong.

================================================================

In my Cisco router, I able to set 2 kinds of MTU.

a) System MTU - the mtu of the interface (layer 2)

b) IP MTU - the mtu of IP (layer 3)

So since i am using Ethernet, i went to search for the size of an ethernet frame.

http://cdn.pathsolutions.com/wp-content/uploads/jumbo-frames-.jpg

Assuming i am looking at a layer 2 ethernet with 802.1q frame (without the preamble and frame delimiter) -> that would be 1522 bytes. But it is set as 1500 which is the same for both the system mtu and IP mtu.

q1) Hence, why isn't the system mtu set at 1522 instead ? (still set as 1500) <- should this be set as the MTU of the payload in the layer 2 frame or as the MTU of the layer 2 frame ?

q2) Why is it set this way ? or why do we need 2 parameters then for setting the MTU ? Assuming if I have a jumbo frame, i should set the jumbo frame system MTU to 9000 ? but my IP mtu can still stay at 1500 ? but then what's the point of having a jumbo frame then ?

q3) can a router have different interface with different MTU ? if so, how does the system MTU help in configuring these values ?

q4) When deciding whether do fragment an IP packet does the router check its System MTU or Interface's IP MTU ?

 

However, I do take note that the minimum frame header size is 22 bytes

===============================================================

IP DATAGRAM/PACKET

Then come the payload, assuming it is IPv4. (screenshot from wiki)

It is said that the "Total Length" is 2 bytes, which represent how large in bytes the packet (including its header + payload can get)  which is 65,535 bytes.  Obviously a packet of such size will not be able to fit into the payload of an ethernet frame.

At this point, i am telling myself that it is a limitation of the payload size in a layer 2 frame.

But overhere, I do take note that the minimum IP header size is 20 bytes.

==============================================================

Maximum Segment Size(TCP)

From wiki, it is mentioned that MSS = specifies the largest amount of data, specified in octets, that a computer or communications device can receive in a single TCP segment. It does not count the TCP header or the IP header.

So I am thinking ok.. my payload of my ethernet frame is 1500bytes. So how large can my TCP segment be ?

1500bytes - 20 bytes (IP header)  - 20 bytes (TCP header) = 1460 bytes for my TCP segment.

But i am totally lost when i read this below

The default TCP Maximum Segment Size is 536  - wiki
  THE TCP MAXIMUM SEGMENT SIZE IS THE IP MAXIMUM DATAGRAM SIZE MINUS  -- RFC 879
      FORTY. 

         The default IP Maximum Datagram Size is 576.
         The default TCP Maximum Segment Size is 536.


q3) why is the default IP maximum datagram size  = 576 ? why isn' it 1500 ? or why isn't it 65,353 bytes ?

q4) why is the default TCP maximum segment size = 536 ?  I have got 1460 bytes of free space , isn't it ?


========================================================

UDP datagram

So I move on to UDP

Length = 2 bytes

Hence maximum size of a UDP datagram -> 65535  bytes

Header size of UDP = 8 bytes

Maximum size of UDP datagram without header = 65535 - 8 = 65527 bytes.

Maximum size of UDP datagram without header inside IP datagram  = 65527 - 20 bytes ( ip header) = 65507 bytes

But again, it still will not be send as the MTU is 1500.

=================================================

Fragmentation

q5) Can i say irregardless of TCP or UDP,  if the MTU between 2 gateway does not match, IP fragmentation will occur ?

q6) I read and it says that it depends on the end-devices to rebuild the fragmented packets, so if 1 packet out of the original e.g 5 fragmented packets is lost , the whole message will be discarded ? 
if it is TCP, then the sending device will have to resend the whole message (resulting in another 5 fragmented packets ?)

==================================================

 

Regards,
Noob

 

 

17 Replies 17

Hi Jospeh,

 

Then ain't we falling back to the same issue again.

How IP MTU appears to work on tunnels, it compares to the packet's size without encapsulation overhead.  The physical egress interface, though, compares to the packet's size with the encapsulation overhead.

Assuming IP-MTU = 1476
Packet size without GRE overhead = 1476
It compare the packet size without the encapsulation overhead. - OK passed

The physical egress interface, though, compares to the packet's size with the encapsulation overhead (which you mention can be IP-MTU or MTU)

Then again, if comparing against IP-MTU, after adding the encapsulation it is +24 = 1500 which is > IP-MTU. Wouldn't the packet be fragmented then ?

 

Regards,
Noob

Yes and no.  It depends on how the interfaces are configured.  Often, when working with Ethernet, only the tunnel's IP MTU is set to reflect what the physical egress interface can support with encapsulation.

For example:

interface tunnel 1

ip mtu 1476

interface ethernet 0

ip mtu 1500 !default

So, if tunnel 1 (GRE) uses Ethernet 0 and the packet it's sending is 1476, or less, the encapsulated packets, sent to Ethernet 0, won't need to be fragmented.

Ahh.. Joseph..

I get what you mean now.

 

Thanks!