Understand MTU and MRU - The Full Story
MTU or Maximum transmission unit is a topic that pops up every once in a while in different discussions. Although it's a simple concept, it causes a lot of confusion specially for those who are new to the field. MTU typically becomes an issue of concern during network changes, like adding new vendors equipment or upgrading to a new software. One reason for that is the difference in implementations used by different vendors or even between different OS versions or equipment from the same vendor. Here is an example for such confusion MTU and ping size confusion.
On the other hand MRU which I was discussing today with a college or maximum receive unit is not talked about as much, probably because it rarely pops up in problems or configuration requirements and it typically matches MTU by default, but doesn't have to be.
Let's build up these concepts from scratch.
What is a data packet?
A packet is the single unit of data that is routed between a source and a destination on the network. Each packet contains information to help devices route or switch the packet to its destination and actual data known as payload.
What is MTU?
A maximum transmission unit (MTU) is the largest length of a packet that can be transmitted out of an interface toward a destination. When the word MTU is used plainly, we are typically referring to the interface MTU, but when talking about a protocol MTU (e.g IP MTU, MPLS MTU) we are typically referring to the maximum payload of the protocol itself.
Whether the headers are included or not is an implementation that can vary from box to another and from OS to another, so it should always be tested out specially when operating on a multivendor environment.
We can't really understand how MTU is playing a part in network operations, without understanding the concept of path MTU.
Path MTU: is to the lowest MTU of an interface on the path between the source and destination. Path MTU is a very important aspect because it has a huge impact on the overall performance of the network and end user experience.
The image below presents an analogy to clarify the path MTU concept. As you can see in the image the yellow rectangles height represents the exit interface MTU of the router (don't confuse this with bandwidth). The packet in the diagram can easily fit the MTU of the interfaces in the first segment connecting routers A and B; in the second segment, the MTU is smaller and such big packet doesn't fit the yellow rectangle (interface MTU) in one chunk. Therefore the path MTU is actually the MTU of the second exist interface (The smallest), because the whole path will only be able to pass packets that fits this MTU.
[caption id="attachment_1120" align="aligncenter" width="755"] Path MTU Analogy[/caption]
Default interface MTU values: source Wikipedia
|Media||Maximum Transmission Unit (bytes)||Notes|
|Internet IPv4 Path MTU||At least 68, max of 64KB||Practical path MTUs are generally higher. Systems may use Path MTU Discovery to find the actual path MTU.|
|Internet IPv6 Path MTU||At least 1280,max of 64KB, but up to 4GB with optional jumbogram||Practical path MTUs are generally higher. Systems must use Path MTU Discovery to find the actual path MTU.|
|Ethernet v2||1500||Nearly all IP over Ethernet implementations use the Ethernet V2 frame format.|
|Ethernet Jumbo Frames||1501 - 9198||The limit varies by vendor. For correct interoperation, the whole Ethernet network must have the same MTU.Jumbo frames are usually only seen in special-purpose networks.|
|PPPoE over Ethernet v2||1492||= Ethernet v2 MTU (1500) - PPPoE Header (8)|
|PPPoE over Ethernet Jumbo Frames||1493 - 9190||= Ethernet Jumbo Frame MTU (1501 - 9198) - PPPoE Header (8)|
What happens if a packet size is bigger than path MTU?
If one host is sending packets that are having a bigger length than the path MTU and IPv4 is in play, these packets will be fragmented if Don't Fragment (DF) bit is not set. If they can't be fragmented they will be dropped by the device processing them and an ICMP message with code "fragmentation needed" will be sent to the source to warn it about the problem. Fragmentation is generally a bad thing; it increases network overhead, consumes routers resources and results in many unwanted side effects.
When the source receives "fragmentation needed" ICMP packets, it needs to lower it's packet size to match to avoid packets being dropped by middle routers.
If IPv6 is in play, we know that it doesn't support fragmentation, such large packets will be dropped and ICMPv6 message "Packet too big" will be sent to the source to inform it that it needs to lower the packet size to avoid the drops.
There are some mechanism that are used solely to avoid these problems in the first place. Two of them are PMTUD and TCP MSS adjust.
What is path MTU discovery (PMTUD) ?
Path MTU discovery is a standardized mechanism that is used by end hosts to avoid fragmentation or packet drops. The basic idea is that the source host will assume that the path MTU is equal to it's exit interface MTU and will send all packets on the path with (DF bit) set. If any of the packets is bigger than the path MTU, it will be dropped by the middle routers and an ICMP message will be sent to the source to inform it that it needs to lower the packet size.
The process will continue by the host until it determines the suitable packet size and to detect any changes in the paths or it will remove the DF bit and allow the packets to be fragmented.
The process is pretty similar when using IPv6, with the difference that fragmentation is not allowed in IPv6 and there is No DF bit to set.
For full details refer to the following RFCs:
- RFC 1191, Path MTU Discovery, J. Mogul, S. Deering (November 1990)
- RFC 1981, Path MTU Discovery for IP version 6, J. McCann, S. Deering, J. Mogul (August 1996)
What is TCP MSS?
[caption id="attachment_1119" align="aligncenter" width="568"] TCP MSS[/caption]
I wanted to touch briefly on Maximum segment size, known as TCP MSS.
TCP MSS is an option in the TCP header that is used by the two ends of the connection independently to determine the maximum segment size that can be accepted by each host on this connection. The maximum segment size is simply the maximum data payload that a TCP packet can accommodate on the connection.
This option can be manipulated by network operators using a feature known as TCP MSS adjust. The feature allows middle routers to intercept and alter this value if configured to do so as a technique to avoid MTU problems mentioned above.
On the other hand maximum receive unit (MRU) is the largest packet size that an interface can receive, so it's an ingress interface parameter. In most of the cases MRU equals MTU but it's not a requirement. You can configure different values for both MTU and MRU to achieve some benefits.
What if packets received are bigger than interface MRU?
If a device is receiving packets that are bigger in length than interface MRU due to some reason, the packets will be considered "Too big" or oversized. Usually there will be a counter incrementing on the interface and those packets will likely be dropped by the router's forwarding plane.
Resources worth checking:
- Packet encapsualation (MTU) calculator.
- Ivan Pepelnjak, has a very good video on TCP MSS clamping.
- Matt Dinham, has documented his tests for MTU settings on different platforms and OSs.
- MTU and Ping size confusion.