Huawei настройка роутера mtu

What Is Maximum Transmission Unit (MTU)?

Maximum transmission unit (MTU) is the maximum size of a data packet transmitted on a network, in bytes. A proper MTU improves transmission efficiency.

Synonyms

Category

References

Abstract

MTU is the maximum length of a data packet that can be transmitted on a network, in bytes. The MTU determines the maximum number of bytes in a packet that a sender can send each time. If the MTU exceeds the maximum number of bytes supported by a receiver or transit node on the transmission path, the receiver or transit node fragments or even discards packets, aggravating the network transmission load. If the MTU is too small, the actual amount of transmitted data is too small, affecting the transmission efficiency.

Image

Video

Why Do We Need MTU?

In a network, information is typically transmitted using data packets. Therefore, it is essential to determine the packet size to ensure packet transmission efficiency. If the packet size is set to a large value, more valid data is contained in a packet and the communication efficiency is higher. However, the delay in packet transmission is longer, and the probability of bit errors in the packet is higher. In addition, if the packet is lost, the retransmission cost is high. If the packet size is set to a small value, transmitting the same amount of data requires more packets, and the device then needs to process more packets. This requires high line-rate forwarding capability of the device. By setting the MTU, you can adjust the size of data packets transmitted on the network so that the most appropriate MTU is available on different networks, improving the forwarding efficiency.

The MTU limits the length of a data frame at the data link layer. The default MTU value varies according to the link medium type. The following lists the default MTU values on some common networks.

Why Is the Ethernet MTU Usually Set to 1500 Bytes?

RFCs define that the default Ethernet MTU is 1500 bytes. Why is the default Ethernet MTU value of 1500 bytes?

Early Ethernet networks worked in shared link mode. To ensure the carrier sense multiple access with collision detection (CSMA/CD) mechanism, the minimum length of an Ethernet frame is 64 bytes and the maximum length is 1518 bytes. The minimum length of 64 bytes ensures that the most extreme collisions can be detected, and 64 bytes refers to the minimum length of packets that can be detected. The maximum length of 1518 bytes prevents other services from being blocked because the shared link is occupied for a long time during the transmission of large frames. Therefore, the Ethernet frame size of 64 bytes to 1518 bytes remains unchanged.

The maximum size of an Ethernet frame is 1518 bytes, which consists of the 14-byte frame header, 4-byte frame trailer, and 1500-byte upper-layer IP packet. The size of 1500 bytes is the default Ethernet MTU value. Network layer protocols, such as the IP protocol, determine whether to fragment the data sent from the upper layer based on the MTU. If the length of a single IP packet is greater than the MTU, the packet is fragmented into IP packets that are smaller than or equal to the MTU before being sent out from an interface.

Читайте также:  Настройка мобильного роутера tp link

Actually, different vendors or even different product models of the same vendor define the MTU differently:

  • The MTU indicates the maximum length of the entire IP packet (IP header + Layer 3 payload). In this case, the MTU refers to the IP MTU. For example, on Huawei NetEngine series routers and CloudEngine series switches, the MTU refers to the IP MTU.
  • The MTU is the sum of the IP packet length and Ethernet header length, that is, MTU = IP MTU + 14 bytes. For example, on some Cisco devices, the MTU is the sum of the IP MTU and Ethernet header.
  • The MTU is the sum of the IP packet length, Ethernet header length, and CRC length, that is, MTU = IP MTU + 18 bytes. For example, on some Juniper devices, the MTU is the sum of the IP MTU, Ethernet header length, and CRC length.

When setting the MTU value, focus on the MTU values defined by vendors and products.

How Are Packets Exceeding the MTU Fragmented?

The default Ethernet MTU is 1500 bytes. If less than or equal to 1500 bytes of data needs to be sent at the IP layer, the data can be sent through only one IP packet. If more than 1500 bytes of data needs to be sent at the IP layer, the data must be fragmented before being sent.

Assume that a host sends a packet with the payload length of 2000 bytes and that the MTU on the outbound interface is 1500 bytes. The following describes the process of fragmenting the packet. The packet is encapsulated at the network layer. It consists of a 20-byte IP header and a 2000-byte data payload. After the packet is encapsulated, the packet length is 2020 bytes. When the packet is forwarded out of the device through the outbound interface, the device finds that the IP packet length exceeds the MTU of 1500 bytes and fragments the packet. The following figure shows IP packet fragmentation in this scenario.

For the first fragment, the IP packet header is fixed at 20 bytes, so the 1480-byte data payload can be encapsulated. This is because the MTU is 1500 bytes and the data payload length must be a multiple of 8.

For the second fragment, the IP header has a fixed length of 20 bytes, so the data payload is the remaining 520 bytes (the total data payload length of 2000 bytes minus the 1480 bytes encapsulated in the first fragment). If the length of the last fragment is less than 46 bytes, the last fragment is automatically padded to 46 bytes.

After all fragments arrive at the destination host, the destination host reassembles these fragments to restore them to the original packet. During the reassembly, the More Fragments (MF) flag identifies whether a fragment is the last fragment, and the fragment offset identifies the position of a fragment in the original packet. Based on these fields, the destination host accurately reassembles the fragments.

Читайте также:  Vpn surfshark настройка роутера

Jumbo Frame and MTU

After decades of development, the Ethernet speed has increased from 10 Mbit/s to hundreds of Gbit/s. In such high-speed data transmission, if the maximum Ethernet frame length is still 1518 bytes, a large number of data packets are transmitted per second. Each data packet needs to be processed by network devices, introducing high extra overhead. The overhead becomes more noticeable as the network speed increases.

Therefore, some vendors put forward the concept of jumbo frame, which extends the maximum Ethernet frame length to 9 KB. The following compares jumbo frame and MTU:

  • Jumbo frames are processed at the data link layer. MTU-involved fragments are typically processed at the network layer.
  • A jumbo frame consists of a Layer 2 Ethernet header and a CRC field. The MTU refers to the length of a Layer 3 IP packet and does not include a Layer 2 Ethernet header or CRC field. In network applications, the maximum MTU is limited by the minimum size of a jumbo frame, and the MTU must be at least 18 bytes smaller than a jumbo frame.

The use of jumbo frames reduces the number of data packets transmitted on networks and relieves the extra overhead of processing packet headers by network devices. This in turn improves the performance of network devices. Although the vendor-specific jumbo frame format has not been recognized by the IEEE Standards Committee, most vendors start to support the format.

TCP MSS vs. MTU

TCP maximum segment size (MSS) refers to the maximum data segment that can be transmitted each time using TCP. The MSS is the size of the TCP Payload, excluding the TCP Header and TCP Option. The MSS is used in TCP to limit the maximum number of bytes sent at the application layer. To achieve the optimal transmission efficiency, the MSS value of both ends needs to be negotiated during the establishment of a TCP connection. The MSS value is calculated based on the MTU value in TCP implementation (the 20-byte IP packet header and 20-byte TCP packet header need to be deducted). Therefore, the MSS value is usually 1460 bytes (1500-byte MTU – 20-byte IP Header – 20-byte TCP Header).

Path MTU vs. MTU

The path MTU refers to the maximum size of a packet that can pass through a transmission path without being fragmented. If the MTUs of network devices on the transmission path from the transmit end to the receive end are inconsistent, the available MTU of the path is actually the minimum MTU of the entire path. The path MTU improves transmission efficiency and avoids fragmentation.

RFC 1191 (IPv4) and RFC 1981 (IPv6) define the dynamic detection of the path MTU to determine the available path MTU between two IP hosts. The source node sends a probe packet that cannot be fragmented through its outbound interface, with the MTU of the outbound interface being the path MTU. When a forwarding device on the transmission path has an MTU smaller than the current path MTU, the forwarding device sends a response packet carrying its own MTU to the source node. Then the source node changes its path MTU to the MTU specified in the response packet and continues to send packets. This process repeats itself until packets are sent to the destination. In this way, the source node obtains the available path MTU.

Читайте также:  Отличие вай фай роутера от вай фай модема

Currently, no effective method is available to discover the path MTU on an IPv4 network due to the following reasons:

  • Some carriers or websites filter out ICMP probe packets for network security or other purposes.
  • Path MTU detection requires cooperation between hosts and various network devices (such as switches, routers, and firewalls) on the Internet. However, some network devices do not comply with RFC 1191.

How to Set the Proper MTU?

On networks, MTU definitions and fragmentation mechanisms vary according to vendors and models of devices from the same vendor. As a result, network problems, such as protocol interconnection failures, website or link access failures, and game freezing, often occur. Therefore, a proper MTU is essential.

The basic principle is that the MTUs of the Ethernet interfaces on the two interconnected Layer 3 devices must be the same.

In addition, the impact of encapsulation in multiple scenarios on the packet size needs to be considered. For example, during the encapsulation of an MPLS label, each MPLS label adds 4 bytes of overhead to a packet, which may cause the packet length to exceed the maximum length allowed by the link layer. As a result, packets cannot be forwarded.

MTU configuration suggestions for the backbone network, metropolitan area network (MAN), and access network

To ensure that the backbone network, MAN, and access network work properly, the MTU value must be much greater than the default Ethernet MTU value of 1500 bytes. Generally, high-end routers and switches support large data packets of more than 9000 bytes. However, the default MTUs of devices from many vendors are still 1500 bytes. In addition, because routing protocols that require MTU negotiation, such as OSPF and IS-IS, may run on the network, the MTUs of interconnected devices from different vendors must be the same.

Therefore, you are advised to set the MTU to a large value when the network and carrier specifications are met and the MTU is supported by devices from all vendors.

MTU configuration suggestions for LANs such as data centers

On a large-scale data center network, the MTU is not adjusted in a unified manner. With the application of new technologies, the MTU problem will be gradually exposed. For example, various tunneling technologies, such as virtual private LAN service (VPLS) and virtual extensible LAN (VXLAN), are used for large Layer 2 expansion. Oversized packets are generated after packets are encapsulated using these tunneling technologies. For example, VXLAN encapsulation adds 50 bytes to the original packet. If the MTUs are not planned in a unified manner, the transmission efficiency is low and services may even be interrupted.

Therefore, in the construction of data center networks, the MTU needs to be set to a large value that is supported by devices from all vendors.

Источник

Оцените статью
Adblock
detector