Set NIC mode parameters on SUSE SLES

While the NIC mode parameters duplex, speed and autoneg can be set at driver load-time in /etc/modprobe.conf.local on SLES systems, this has not always worked as expected for us. This is why we have decided to set NIC mode parameters in a small post-up script which is called from the interface configuration script ifcfg-eth-id-<MAC-address>.

Set IP address and other NIC parameters as usual in

/etc/sysconfig/network/ifcfg-eth-id-<MAC-address>:


BOOTPROTO='static'
BROADCAST='10.1.255.255'
IPADDR='10.1.1.10'
MTU=''
NETMASK='255.255.0.0'
NETWORK='10.1.0.0'
REMOTE_IPADDR=''
STARTMODE='onboot'
UNIQUE='rEge.ndpeasadfV1'
_nm_name='bus-pci-0000:03:06.1'
POST_UP_SCRIPT='eth0'

The POST_UP_SCRIPT eth0 will be searched-for in scripts, it has to be set executable or it will simply fail to run silently. This script is used to set mode parameters to autoneg=off, duplex=full and speed=100.

scripts/eth0
#!/bin/bash
# Set interface parameters in post-up
#
PARAM="duplex full speed 100 autoneg off"
ETHTOOL=`which ethtool`
case ${0##*/} in
eth*[0-9]|tr*[0-9]|wlan[0-9]|ath[0-9])
if [ -x ${ETHTOOL} ]; then
echo " ${0##*/} mode settings: ${PARAM}"
${ETHTOOL} -s ${0##*/} $PARAM
else
echo "Error: ethtool not found"
fi
;;
*)
echo "Error: Can not set mode, not a local interface name (eth*[0-9]|tr*[0-9]|wlan[0-9]|ath[0-9])"
;;
esac

Create a symbolic link to this script to set the same parameters for other NICs.

Note: setting fixed mode parameters is probably not a good idea in times of mixed GigE and 100MB network environments and should only be used if there is no other way.

mike – Thu, 2006 – 04 – 27 17:45