Change Txqueuelen Under Linux

How do I change txqueuelen (transmit queue) under Linux for eth0 card to improve performance? How can I modify txqueuelen of my network interface card (NIC) under Debian or Ubuntu Linux?

Let us see how to modify txqueuelen value for given network interface card (NIC) on RHEL, Fedora, Ubuntu, and Debian Linux.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux with ip command
Est. reading time 1m

How to modify txqueuelen network interface card (NIC) values

How to change Txqueuelen under Linux
You need to type the following command to set txqueuelen under Linux (the following will set it to 10000):
ifconfig eth0 txqueuelen 10000
OR use the ip command:
# ip link set eth0 txqueuelen 10000
A value between 1000 and 20000 per interface is recommended. The txqueuelen parameter to ifconfig set the length of the transmit queue of the device.

Change Txqueuelen Under Linux permanently

Edit the /etc/network/interfaces under Debian or Ubuntu Linux. For instance:
vim /etc/network/interfaces
And add at the end of the line for your interface:
post-up /sbin/ip link set eth0 txqueuelen 10000
Here is how it looked:

auto eth0
iface eth0  inet static
 address 192.168.2.1
 netmask 255.255.255.0
 gateway 192.168.2.254
 dns-domain sweet.home
 dns-nameservers 192.168.2.254
 post-up /sbin/ip link set eth0 txqueuelen 10000

After the Linux system was rebooted, the txqueuelen value is set to 10000 for eth0 network interface on my Debian Linux 10 server. See “How to set up static IP address on Debian Linux 10/11” for more information on the /etc/network/interfaces config options.

Setting up txqueuelen for network interface card under RHEL or CentOS Linux

Edit or create a new file called /sbin/ifup-local
# vim /sbin/ifup-local
Append the following code:

#!/bin/bash
/sbin/ip link set dev eth0 txqueuelen 10000

Make sure you set up executable permissions using the chmod command:
# chmod +x /sbin/ifup-local
I tested above config on CentOS and Red Hat Enterprise Linux version 5/6/7.

Conclusion

The queue length set up using the ip command or ifconfig command. The txqueuelen set up the length of the transmit queue (qdisc) of the device. Typically we set up small values for slower network interfaces with high latency. If packets are dropping, then we set up large values for NIC. Of course, you need to test your setup with various values.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Thiago Rodrigues Feb 19, 2021 @ 20:43

    Realizar essa alteração. Quando reiniciei minha maquinha voltou para configuração antiga que era ip link set eth0 txqueuelen 1000.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum