LAN card or NIC (Network Interface Card) is used to send and receive data. The term ‘duplex’ indicates mode of communication. Full duplex means you are able to send and receive data (files) simultaneously.In half duplex, you can either send or receive data at a time (i.e. you cannot send receive data (files) simultaneously). Obviously, full duplex gives you best user experience. However, how can you find out whether I am using full duplex/half duplex speed/mode?
ethtool command is used for this purpose.If not installed,just type in:
# sudo apt-get install ethtool
To get speed, duplex and other information for the network interface eth0, type the following command .
ashu@like-a-boss:~$ ethtool eth0
You will see the output similar to this:
Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Speed: 10Mb/s Duplex: Half Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Current message level: 0x00000033 (51) drv probe ifdown ifup Link detected: no
100baseTx-FD: 100Mbps full duplex (FD)
100baseTx-HD: 100Mbps half duplex (HD)
10baseT-FD: 10Mbps full duplex (FD)
10baseT-HD: 10Mbps half duplex (HD)
Changing the Duplex settings:
The next command enables Auto-Negotiate feature :
# ethtool -s eth0 autoneg on
Negotiation, enables Half Duplex and sets up Speed to 10 Mb/s :
# ethtool -s eth0 speed 10 duplex half autoneg off
The next command disables Auto-Negotiation, enables Full Duplex and sets up Speed to 100 Mb/s :
# ethtool -s eth0 speed 100 duplex full autoneg off
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"
Restart the interface to apply changes :
# ifdown eth0 && ifup eth0