Slow network card: what is half duplex mode?

Q My box has really poor network performance. Someone recently mentioned I might be set to half duplex (whatever that is). How can I find this out and what speed I am connected at?

A Firstly I'll explain half duplex. In a nutshell this means that your network card has negotiated with your network hardware and is not sending and receiving packets at the same time; in essence it's a one-way conversation. If you are using any modern piece of network hardware you should be able to achieve full duplex easily. When a NIC is connected to a network device it has to negotiate a compatible speed and duplex setting at the physical layer. On most cheaper switches this is done through a process known as autonegotiation: the switch 'advertises' what link modes it supports, the NIC chooses one and informs the switch. This is the default behaviour for most NICs. On more expensive managed switches this setting can be fixed to ensure optimal performance. Often, if this is configured on the switch but your machine is still set to Autonegotiate you'll end up with a duplex mismatch, which causes network performance to be poor. To find out what your NIC is currently set to you need to use the ethtool command:

[root@dan ~]# ethtool eth0

This will show you various details. Note the Duplex and Speed entries; you'll also see what advertised modes the switch supports. Assuming your duplex is the issue and your switch is hard set to, say, 100Mbps for speed and Full Duplex, you can change eth0's setting by executing

ethtool -s eth0 speed 100 duplex full autoneg off

Be aware, though, that this will revert when you reboot the system. To set it permanently you should set the options for your NIC driver in modules.conf when it's loaded. If this doesn't solve the issue there are a number of things you can look at, but first you need to narrow down the issue. Is it a particular service that is slow? Your network connection could be fine but a service could be slow to respond for a number of reasons. Run ifconfig and see if you have any Tx/Rx errors or collisions - is it just your machine? Could it be affecting several machines due to a saturated switch? In essence, you need to track down where the issue lies to define your problem and resolve it!

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar