To change Speed and Duplex of an Ethernet card, we can use ethtool – a Linux utility for Displaying or Changing Ethernet card settings.
1. Install ethtool
You can install ethtool by typing one of the following commands, depending upon your Linux distribution.
Install ethtool in Fedora, CentOS, RHEL etc.:
# yum install ethtool
Install ethtool in Ubuntu, Debian etc.
# sudo apt-get install ethtool
2. Get the Speed, Duplex and other information for the interface eth0
To get speed, duplex and other information for the network interface eth0, type the following command as root.
# ethtool eth0
Settings for eth0:
Supported ports: [ MII ]
Supported link modes: 10baseT/Half 10baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
Advertised auto-negotiation: Yes
Port: Twisted Pair
Supports Wake-on: g
Current message level: 0x000000ff (255)
Link detected: yes
3. Change the Speed and Duplex settings
The next command disables Auto-Negotiation, enables Full Duplex and sets up Speed to 100 Mb/s:
# sudo ethtool -s eth0 autoneg off speed 100 duplex full
Restart the interface to apply changes:
# ifdown eth0 && ifup eth0
4. Change the Speed and Duplex Settings permanently
Fedora, CentOS, RHEL etc.
To make settings permanent, you need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 file for eth0 interface. This file is used by RHEL, CentOS, Fedora etc.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Append the line as follows to disable Auto-Negotiation, enable Full Duplex and set up Speed to 100 Mb/s:
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”
Ubuntu, Debian etc.
If you need to have this settings every time you boot up the PC, you have to add a command in the /etc/network/interfaces file, so:
sudo vim /etc/network/interfaces
And at the beginning of the file add:
pre-up /usr/sbin/ethtool -s eht0 autoneg off 100 duplex full
That will set the parameters before bringing the interface up.