Showing posts with label IPv4. Show all posts
Showing posts with label IPv4. Show all posts

Monday 21 May 2018

IP MTU size- Reasons and IP Padding

What is the minimum MTU size for IP?

For any link, IPv4 mandates a minimum MTU of 68 bytes while the recommended MTU is 576 bytes. This enables any IPv4 stack to send a 68 byte datagram with the assurance that it is guaranteed to be forwarded upto the destination. However such a low MTU would be extremely inefficient. Thus, IPv6 sets a much higher minimum of 1280 bytes. But, the most efficient MTU size is 1500 bytes since the Ethernet MTU is 1500.

WHY IS THE MINIMUM MTU SIZE FOR IP= 68 bytes?

The router divides the packet into fragments. The max size of each fragment is the MTU minus the IP header size (20 bytes minimum; 60 bytes maximum).

The fragment offset are calculated by the formula (Total Length .ie. MTU -  Header Size) /8 . Thus, we need the value of MTU - Header Size to be a multiple of 8 in order to be able to calculate the position of the fragment. For example, for an MTU of 1,500 bytes and a header size of 20 bytes, then, Fragment Offset = (1500- 20)/8 = 185

Thus, similarly, if we take the minimum required value of MTU as 68 bytes and
  • CASE 1: Header Size of 20 (which is the minimum required header size), then:

Fragment Offset = (68- 20)/8 = 6  -> no issues here as it is a positive integer

  • CASE 2: Header Size of 60 (which is the maximum allowed size of IP header), then:

Fragment Offset = (68-60)/8 = 1

Thus, we see that 68 is the ideal minimum value required and no other value of MTU will give the fragment offset value as ‘1’ for the maximum allowed IP header. Hence, 68 was chosen in the RFC 791


Why padding required in IP?

Padding is basically used to make sure that the IP packet header has a length that is a multiple of 32 bits. It is needed because of the varying length of the options field in the IP header.

The minimum length of the data field of a packet (not the entire packet) sent over an Ethernet is 46 bytes.  If necessary, the data field should be padded (with bytes of zero) to meet the Ethernet minimum frame size.  This padding is not part of the IP packet and is not included in the total length field of the IP header.


When does the buffer get full?

Buffer gets full if we get more data on a destination than it can handle. Eg) Video streaming