Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to optimize cpu by modifying MTU under Linux

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to optimize cpu by modifying MTU under Linux, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.

MTU: is the largest transmission unit of the network. Communication term: maximum transmission unit (Maximum Transmission Unit,MTU) refers to the maximum big data packet size (in bytes) that can pass above a layer of a communication protocol. The parameter of the maximum transmission unit is usually related to the communication interface.

1. Related to jumbo frames

1. What is jumbo frames

Jumbo frames refers to the frame that is longer than the standard Ethernet Frames, that is, the size of the frames,Jumbo frame larger than 1518 bit 1522 is specified by each equipment manufacturer and does not belong to the IEEE standard; Jumbo frame runs on the Ethernet network of full-duplex; Jumbo frame defines a "link negotiation" protocol to negotiate with the peer device whether to support the use of Jumbo frames. The standard size of Ethernet IP message is 1500 bit, 18 bit without Ethernet header and FCS. If Ethernet header and FCS are included, 1518 bit;Jumbo frame generally refers to a message whose value of layer 2 encapsulates layer 3 IP message is greater than 9000bit.

Background of Jumbo frames: in 1998, Alteon Networks proposed to increase the maximum data transmission capacity of Data Link Layer from 1500 bit to 9000 bit. Although this proposal has not been agreed by IEEE 802.3 Working Group, most equipment manufacturers have supported it.

2. Advantages of using jumbo frames

In data transmission, because the maximum frame specified by IEEE is 1500 bits (the host is in the early half-duplex network), data transmission needs to go through the process of data combination. The smaller the maximum frame used, the greater the amount of transmission packets, and the corresponding amount of computation will be more, and the consequences are:

A: increase the amount of computation of the host and consume CPU resources

B: affect the speed of network transmission.

And the advantages of using large frames are also self-evident-reducing the amount of CPU calculation and speeding up data transmission.

Second, modify the MTU value

There is a lot of wordiness above, and the actual operation required to change the frame size is to modify the MTU (Maximum Transmission Unit) value, that is, to modify the maximum transmission unit. The modification method is as follows:

1. Ifconfig command modification

Ifconfig ${Interface} mtu ${SIZE} upifconfig eth2 mtu 9000 up

This is the most common approach and works for all linux distributions. The disadvantage is that it fails after reboot and needs to be loaded in the boot item.

2. Modify the configuration file

Under CentOS / RHEL / Fedora Linux

# vi / etc/sysconfig/network-scripts/ifcfg-eth0# add the following content: MTU= "9000" # restart the Nic after saving it takes effect # if IPv6 address is enabled for service network restart#, change the parameter of IPv6 mtu to IPV6_MTU= "1280"

Under Debian / Ubuntu Linux

# vi / etc/network/interfaces# increase the following values: after mtu 900cycles is saved, restart the network takes effect # / etc/init.d/networking restart 3. Why the maximum MTU is 9000 bytes

Theoretically, a 4-bit CRC supports a maximum of 12000 bit bytes, beyond which there is no way to check. There are also restrictions on other protocols such as NFS.

Finally, it should be noted that when passing through the switched network equipment, it is not possible to just modify the MTU value of the host side, and it is also necessary to turn on the jumbo frames function on the switched network equipment.

4. MTU testing

Using the ping command,-l specifies the packet size, and the-f option informs the operating system that the packet size cannot be changed privately

The hint when using the English operating system is: Packet needs to be fragmented but DF set.

Thank you for reading this article carefully. I hope the article "how to optimize cpu by modifying MTU under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report