Is it possible to set multiple ethtool options via the ETHTOOL_OPTS parameter in Red Hat Enterprise Linux ?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL) 4
  • Red Hat Enterprise Linux (RHEL) 5
  • Red Hat Enterprise Linux (RHEL) 6
  • Red Hat Enterprise Linux (RHEL) 7

Issue

  • The ethtool options specified via ETHTOOL_OPTS in /etc/sysconfig/network-scripts/ifcfg-* are ignored if they contain multiple hyphens.
  • The ETHTOOL_OPTS only supports -s option from the ethool command

Resolution

An update for Red Hat Enterprise Linux 6 (from RHBA-2011-1528, This content is not included.BZ#692410) enhanced network start-up scripts to support all ethtool command options. These options can now be set via the ETHTOOL_OPTS parameter in configuration files located in the /etc/sysconfig/network-scripts/ directory and take effect after reboot or network service restart (service network restart or ifdown/ifup commands).

Example :

# cat ifcfg-eth1
DEVICE="eth1"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO="none"
IPADDR="x.x.x.x"
NETMASK="255.255.255.0"
ETHTOOL_OPTS="-K ${DEVICE} tso on; -G ${DEVICE} rx 256 tx 128"
  • Note the use of ${DEVICE} to specify the interface and the seperation of multiple options via a semicolon (;).

If you cannot use the configuration above, you have two other options. The first, and preferred, is described on another Solution and allows running custom commands whenever an interface goes up.

As a last-resort option, you may specify these options in /etc/rc.local file. The inconvenience here is that these commands won't be executed if you do 'service network restart'.

Root Cause

  • The initscripts package did not properly handle ethtool commands that included multiple hyphens.

Diagnostic Steps

The relevant function can be inspected in the file /etc/sysconfig/network-scripts/network-functions :

ethtool_set()
{
    oldifs=$IFS;
    IFS=';';
    for opts in $ETHTOOL_OPTS ; do
        IFS=$oldifs;
        if [[ "${opts}" =~ [[:space:]]*- ]]; then
            /sbin/ethtool $opts
        else
            /sbin/ethtool -s ${REALDEVICE} $opts
        fi
        IFS=';';
    done
    IFS=$oldifs;`
}

If you have this function as above, you can use ETHTOOL_OPTS variable just fine.

Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.