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
Append 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"
If above command failed to work for 1000Mbps use following command:
ETHTOOL_OPTS="speed 1000 duplex full autoneg on"
Under Debian or Ubuntu Linux just create a script as follows:
# vi /etc/init.d/100Mbs
or
$ sudo vi /etc/init.d/100Mbs
Append following lines:
#!/bin/sh ETHTOOL="/usr/sbin/ethtool" DEV="eth0" SPEED="100 duplex full" case "$1" in start) echo -n "Setting eth0 speed 100 duplex full..."; $ETHTOOL -s $DEV speed $SPEED; echo " done.";; stop) ;; esac exit 0
Save and close the file.
Setup executable permission:
# chmod +x /etc/init.d/100MbsOR$ sudo chmod +x /etc/init.d/100Mbs
Now run script when Debian or Ubuntu Linux boots up.
Use update-rc.d command install System-V style init script links:
# update-rc.d 100Mbs defaults
or
# sudo update-rc.d 100Mbs defaultsOutput: Adding system startup for /etc/init.d/100Mbs ... /etc/rc0.d/K20100Mbs -> ../init.d/100Mbs /etc/rc1.d/K20100Mbs -> ../init.d/100Mbs /etc/rc6.d/K20100Mbs -> ../init.d/100Mbs /etc/rc2.d/S20100Mbs -> ../init.d/100Mbs /etc/rc3.d/S20100Mbs -> ../init.d/100Mbs /etc/rc4.d/S20100Mbs -> ../init.d/100Mbs /etc/rc5.d/S20100Mbs -> ../init.d/100Mbs
Reboot the system to take effect or just type script name:
# /etc/init.d/100Mbs start or <code> $ sudo /etc/init.d/100Mbs start
Source: http://www.cyberciti.biz/tips/howto-linux-add-ethtool-duplex-settings-permanent.html