Persistent txqueuelen network parameter using udev

https://cstan.io/en/post/2013/08/persistenter-txqueuelen-netzwerk-parameter-mithilfe-udev/

Aug 21, 2013 · 2 min read · Share on: txqueuelen is one of many configurable networking parameters. This paremeter defines the queue size in which the kernel stores data before it is sent over the network. By default this parameter has a value of 1000 - depending on your application you might want to increase this value using ifconfig or ip:

ifconfig eth0 txqueuelen 5000

ip link set eth0 txqueuelen 5000

This is no smart solution because this command has to be entered again after each reboot or network restart. Of course you could also insert the command into the /etc/rc.local script - but there is a much nicer way to get it working.. 🙂

According to a bugfix report there should be a variable for Red Hat Enterprise Linux or CentOS which can be used in the network interface configuration file for setting parameters. This isn’t working under RHEL5 and 6 for me:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

… IFCONFIG_OPTS=”txqueuelen 5000”

ESC ZZ

ifdown eth0; ifup eth0

ifconfig eth0|grep txqueuelen

      collisions:0 txqueuelen:1000 You can implement this very comfortable using udev: simply create a small rule under /etc/udev/rules.d/60-custom-txqueuelen.rules - this rule runs the above-named ifconfig command after the network interface is recognised:

#

custom txqueuelen parameter value

#

Sets a custom txqueuelen parameter value for network interfaces.

This variable sets the length of the transmit queue of a device.

The default value is 1000 - depending on your application setup you

might want to increase this value (e.g. 5000)

#

KERNEL==”eth[0,1]”, RUN+=”/sbin/ifconfig %k txqueuelen 5000” #KERNEL==”eth[0-9]”, RUN+=”/sbin/ifconfig %k txqueuelen 5000” gdscript3 You could also use the ip command instead - ifconfig is well-known obsolete:

… KERNEL==”eth[0,1]”, RUN+=”/sbin/ip link set %k txqueuelen 5000” #KERNEL==”eth[0-9]”, RUN+=”/sbin/ip link set %k txqueuelen 5000” Run one of the following commands to apply the changes:

udevtrigger

/sbin/udevadm trigger

The value has been changed:

ifconfig eth0|grep txqueuelen

      collisions:0 txqueuelen:5000 # ifconfig eth1|grep txqueuelen
      collisions:0 txqueuelen:5000

Updated: