linux mtu refers to the maximum transmission unit of the network. Its full English name is "Maximum Transmission Unit", which refers to the maximum data packet size that can pass through a certain layer of a communication protocol. The maximum transmission unit is Parameters are usually related to the communication interface.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What is linux mtu?
Set the MTU value of the network card reasonably on Linux
MTU: It is the maximum transmission unit of the network. Communication terminology: Maximum Transmission Unit (MTU) refers to a type of communication The maximum packet size (in bytes) that can pass through a certain layer of the protocol. The maximum transmission unit parameter is usually related to the communication interface.
When the MTU is unreasonable, the following problems will occur: 1. When the local MTU value is greater than the network MTU value, the locally transmitted "data packet" is too large, causing the network to unpack it and transmit it, which not only generates additional data packets, And it consumes the time of "unpacking and assembling the package". 2. When the local MTU value is smaller than the network MTU value, locally transmitted data packets can be transmitted directly, but the upper limit of the data packet transmission size given by the network cannot be fully utilized, and the transmission capability is not fully utilized. What is a reasonable MTU value? Make the local MTU value consistent with the MTU value of the network, so that the size of the data packet will not exceed the MTU value of the network transmission, and it will have to be unpacked, then packaged, and then forwarded. The so-called reasonable Setting the MTU value is to make the local MTU value consistent with the network MTU value, which can fully exert the transmission performance without allowing data packets to be split. How to detect a reasonable MTU
Detecting MTU value under Linux
ping -s 1460 -M do baidu.com
Meaning: The size of the sent packet is 1460 (28) bytes, and the router is prohibited from splitting the data packet.
Detecting MTU value under windows
ping -f -l 1460 baidu.com
Reply result 1. If the reply is normal, it means that the maximum MTU allowed by the network is 1500 bytes, which is the same as the system default. You only need to change the MTU of your own route. Just set it to 1500. 2. If there is no normal reply, it means that the data packet size exceeds the MTU size limited by the network. You need to reduce the probe packet size and try again. How to modify the MTU value
Linux temporary modification
ifconfig eth0 mtu 1488 up
Why is the mtu value the detected value plus 28? Because ping uses the icmp protocol, the detection value you specify is the length of the data payload of the packet. , you also need to add a 20-byte ip header and an 8-byte icmp encapsulation
#What problems may be caused by incorrect MTU setting (usually the default is 1500)
One: After using pptp, the mtu on the server is not changed to a small size, which may cause the bandwidth to be unable to run
Second: After using GRE, the mtu on the server is not changed to a small size, which may cause some websites to be unable to be opened, such as Baidu , hao123 and other
recommended learning: "Linux Video Tutorial"
The above is the detailed content of what is linux mtu. For more information, please follow other related articles on the PHP Chinese website!