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:

cat /sys/class/net/ens2f0/statistics/rx_missed_errors
ip -s -s link show
ifconfig ens2f0
ethtool -S ens2f0 | grep rx_missed_errors && sleep 10 && ethtool -S ens2f0 | rx_missed_errors

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.

You can monitor the number of missed_errors, for example, through Zabbix-agent by specifying in its configuration:

UserParameter=missed_errors_ens1f1,cat /sys/class/net/ens1f1/statistics/rx_missed_errors
UserParameter=missed_errors_ens3f1,cat /sys/class/net/ens3f1/statistics/rx_missed_errors

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