How to add ethtool duplex settings to a network card
To set the interface speed, duplex or auto negotiation on Linux system boot up (make settings permanent), you need edit /etc/sysconfig/network-scripts/ifcfg-eth0 file for eth0 interface. This file used by Red Hat enterprise Linux, Fedora core, Cent Os etc.
Open the file:
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
Add following line:
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”
Save and close the system. It will set the eth0 device to 100Mbs, full duplex, with the auto negotiation off at boot time. You can simply restart the networking (it will disconnect all ssh or ftp session) or restart the server. Depend upon traffic and load it may take upto 1 minute to setup a new port speed:
$ /etc/init.d/network restart
If you want 1000Mbs set line as follows:
ETHTOOL_OPTS=”speed 1000 duplex full autoneg off”
Update: if above command failed to work for 1000Mbps use following command (see below in comment sections for discussion) :
ETHTOOL_OPTS=”speed 1000 duplex full autoneg on”
For Debian or Ubuntu Linux
Type the following command (and test them one by one)
$ sudo ethtool –change eth0 speed xxx duplex yyy autoneg off
where xxx = 10, 100 or 1000 and yyy = half or full.
So start with 10 half, 10 full, 100 half, …
Do an ifconfig to check whether you got an IP address.
Go back to first step until it stops working and use the previous values that still worked to:
To make the change permanent, execute the following command:
$ sudo nano /etc/network/interfaces
and type at the pre-up section:
$ pre-up /usr/sbin/ethtool –change eth0 speed xxx duplex yyy autoneg off