Understanding MTU (Maximum Transmission Unit) in Networking

Learn what MTU (Maximum Transmission Unit) is and how it affects network performance. Discover how MTU size impacts data transfer efficiency, the relationship between MTU and packet fragmentation, and best practices for MTU settings.



What is MTU?

MTU, or Maximum Transmission Unit, is a term used in computer networking to refer to the largest data packet or frame that can be transferred between two nodes using a network connection. The size is measured in bytes or octets, where one octet equals an eight-bit byte. MTU is most commonly used in Ethernet connections that implement the Internet Protocol, but it differs from maximum frame size.

Having a larger MTU leads to reduced overhead, but smaller MTU can reduce transmission delays. MTU values are typically determined by the network's capacity and should be managed manually or automatically to avoid exceeding that capacity.

Some network nodes can adjust the MTU when connecting to other nodes through Path MTU Discovery, and MTU values may vary depending on the communication interface or standard.

Application of MTU

MTU plays a key role in network protocols. It specifies the maximum size, in bytes or octets, of the data that the network layer can transmit. MTU values are defined by the communication interface (e.g., serial ports or NICs) and influenced by protocols like Ethernet.

For example, in Ethernet, the maximum frame size is 1518 bytes, but the MTU is 1500 bytes. The remaining 18 bytes are overhead data added by network layers, including headers and checksums.

MTU and Packet Fragmentation in the Network

Each network node has an MTU limit that determines the maximum data packet size it can send or receive. Before transmitting data, the sender ensures that the packet size is within the MTU of the next node in the path. If the packet exceeds the MTU, it is fragmented into smaller pieces.

Although fragmentation reduces performance by adding delay and overhead, it ensures that data is transmitted successfully across the network. To optimize network performance, the sender node should select an MTU value that is less than the MTU of any intermediate nodes, preventing the need for fragmentation.

Packet fragmentation is only supported in IPv4. If a packet larger than the MTU is sent over IPv4, it is automatically fragmented unless the "do-not-fragment" flag is set. IPv6, however, does not support fragmentation. If a packet exceeds the MTU, it is discarded.

Types of Maximum Transmission Units

Ethernet MTU

Ethernet, which operates at the data link layer of the OSI model, typically has an MTU of 1500 bytes, with the maximum frame size being 1518–1520 bytes. This accounts for the header and other overhead data in the frame. The Ethernet MTU sets the upper limit for higher-level protocol data frames.

IP MTU

IP, which operates at the network layer of the OSI model, can have an MTU independent of Ethernet's. However, the IP MTU must always be smaller than the Ethernet MTU. The size of the IP MTU includes both the data and the overhead (e.g., the 40-byte TCP/IP header).

In the analogy, think of a forklift with a 1500 kg weight limit. If the total weight exceeds this, the forklift can't carry it, similar to how an IP MTU must fit within the Ethernet MTU.

Jumbo Frames and MTU

Jumbo frames allow for an MTU larger than the standard 1500 bytes, with Gigabit LANs supporting up to 9000 bytes. These larger packets are beneficial in reliable networks, reducing overhead and improving efficiency. However, jumbo frames are typically not used over the internet but are beneficial in dedicated networks like storage area networks (SANs), where large data volumes are common.

Determining MTU for All Nodes

Path Maximum Transmission Unit Discovery (PMTUD) is the process of determining the MTU for all nodes in the data path between a sender and receiver. This prevents fragmentation and packet loss when a node cannot support fragmentation.

To determine the MTU of a node, users can send large test data packets and check if they are dropped, which indicates the packet size exceeds the MTU. In Windows, the ping command can be used with the -f and -l switches to perform this check.

Optimizing Maximum Transmission Units

There is no universal optimal MTU for all network nodes. MTU values vary based on the protocols and connections used by each node. To ensure efficiency, the MTU should be adjusted to the smallest MTU in the transmission path, avoiding fragmentation.

For example, nodes using IPsec or VPN protocols need to account for the additional overhead introduced by these protocols to avoid fragmentation.

Internet Protocol and its Effect on MTU

Different network technologies and protocols may impose different MTU sizes. IPv4 allows for fragmentation, where data packets are split into smaller units to meet the MTU limit. However, fragmentation can increase overhead, as the same data is transmitted in multiple packets, leading to inefficiencies.

IPv6 does not allow fragmentation, and larger packets are dropped if they exceed the MTU.

Disadvantages of Using Larger MTU

While larger MTUs increase data transmission efficiency by reducing the number of packets needed, they also pose challenges. Larger packets take more time to transmit, causing delays. Additionally, if a communication error occurs, the entire data packet must be retransmitted, leading to higher network costs.

Large packets are more likely to be corrupted, and their retransmission takes longer. Despite these issues, larger MTUs can still offer advantages in terms of bulk throughput in networks with low error rates.

Syntax

int mtu = 1500;
Output

The MTU is set to 1500 bytes.