User Tools

Site Tools


howtos:setting_network_speed_and_duplex

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:setting_network_speed_and_duplex [d/m/Y H:i] (current)
Line 1: Line 1:
 +====== Changing your Network Interface Speed, Duplex or Auto Negotiate settings on Red Hat Linux ======
  
 +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:
 +<code>
 +# vi /etc/sysconfig/network-scripts/ifcfg-eth0
 +</code>
 +
 +Append following line:
 +
 +<file>
 +ETHTOOL_OPTS="speed 100 duplex full autoneg off"
 +</file>
 +
 +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:
 +
 +<code>
 +# /etc/init.d/network restart
 +</code>
 +
 +If you want 1000Mbs set line as follows:
 +
 +<file>
 +ETHTOOL_OPTS="speed 1000 duplex full autoneg off"
 +</file>
 +
 +If above command failed to work for 1000Mbps use following command:
 +
 +<file>
 +ETHTOOL_OPTS="speed 1000 duplex full autoneg on"
 +</file>
 +
 +
 +====== Debian or Ubuntu Linux permanent settings ======
 +
 +
 +Under Debian or Ubuntu Linux just create a script as follows:
 +
 +<code>
 +# vi /etc/init.d/100Mbs
 +</code>
 +
 +or
 +
 +<code>
 +$ sudo vi /etc/init.d/100Mbs
 +</code>
 +
 +Append following lines:
 +
 +<file>
 +#!/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
 +</file>
 +
 +Save and close the file. 
 +
 +Setup executable permission:
 +
 +<code>
 +# chmod +x /etc/init.d/100MbsOR$ sudo chmod +x /etc/init.d/100Mbs
 +</code>
 +
 +Now run script when Debian or Ubuntu Linux boots up. 
 +
 +Use update-rc.d command install System-V style init script links:
 +
 +<code>
 +# update-rc.d 100Mbs defaults
 +</code>
 +
 +or
 +
 +<code>
 +# 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
 +</code>
 +
 +Reboot the system to take effect or just type script name:
 +
 +<code>
 +# /etc/init.d/100Mbs start
 +
 +or
 +
 +<code>
 +$ sudo /etc/init.d/100Mbs start
 +</code>
 +
 +----
 +
 +Source: http://www.cyberciti.biz/tips/howto-linux-add-ethtool-duplex-settings-permanent.html
howtos/setting_network_speed_and_duplex.txt · Last modified: d/m/Y H:i (external edit)