Changing TX and RX network interface buffers in Linux

I will give an example of changing the TX and RX buffers of network interfaces in Linux.
First, install ethtool if it is not installed:

sudo apt install ethtool

Let’s look at the names of the network interfaces:

ifconfig -a

Let’s see if the packets are lost, for example, if a large traffic passes through the server, then the value of “missed” can increase:

ip -s -s link show
ifconfig ens2f0

If lost, then let’s see the current and maximum size of TX and RX buffers:

ethtool -g eth0

If necessary, change the maximum size (the changes will be reset after rebooting the server):

sudo ethtool -G eth0 rx 512
sudo ethtool -G eth0 rx 512 tx 512

To make changes after the server restart, I opened the file (in the nano editor, Ctrl + O is used to save the changes, Ctrl + X to exit):

sudo nano /etc/network/interfaces

And added a line:

post-up /sbin/ethtool -G eth0 rx 512 tx 512

Sometimes when starting the server, the commands from /etc/ network/interfaces may not be run, in this case we add them to /etc/rc.local, for example:

/sbin/ethtool -G eth0 rx 512 tx 512

Done, after the server was restarted, the values were the ones that you need.

See also my articles:
Configuring the Network in Linux
Monitoring current RX and TX network interface buffers in Zabbix

Leave a comment

Leave a Reply