Need to change your server at Full Duplex Mode ??
In previous articles we talked a bit about how to change the speed of the network card (NIC), the duplex or the auto-negotiated value in Linux, using the ethtool command.
Making speed, duplex changes permanent in Red Hat Linux
In order for the speed, duplex or auto-negotiation values to be enabled from Linux boot, you need to edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 where eth0 indicates the interface. This file is used by Red Hat enterprise Linux, Fedora core, Cent Os etc.
We open the file /etc/sysconfig/network-scripts/ifcfg-eth0 and add the following line:
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”
Let’s save and reboot the system. During boot the eth0 device will be set to 100Mbs, full duplex, with autonegotiation turned off. If it is not possible to completely shut down the system, we can type the command to only restart the network;
[ root@deathbian ~]# /etc/init.d/network restart
Depending on system load it may take a couple of minutes for the ethernet port speed to change. Now if we want to change the configuration of the network card to Gigabit or 1000Mbps, we change the previous line in the same file for this:
ETHTOOL_OPTS=”speed 1000 duplex full autoneg off”
If for some reason the command failed when trying to set the speed to 1000Mbps, use the following command:
ETHTOOL_OPTS=”speed 1000 duplex full autoneg on”
Permanent Settings on Linux Debian or Ubuntu
Under Debian or Ubuntu just create the following script, as root:
SPEED=”100 duplex full”
case “$1” in
echo -n “Setting eth0 speed 100 duplex full…”;
$ETHTOOL -s $DEV speed $SPEED;
Then save and close the file, and then give it execution permissions:
root@deathbian :~# chmod +x /etc/init.d/100MbsOR$ sudo chmod +x /etc/init.d/100Mbs
In order for our script to auto-execute when Debian or Ubuntu starts, we use the update-rc.d command, which installs the links in the init for the scripts;
root@deathbian :~# update-rc.d 100Mbs defaultsOR# 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
Shut down or reboot the system for the changes to take effect, or just run the script by hand;
root@deathbian :~# /etc/init.d/100Mbs start
This is all !!