Linux Ethtool Helps Troubleshooting Ethernet Network Cards Issues

The Ethtool command is used to change Ethernet adapter settings. With the use of this command, you can change network card speed, auto-negotiation, wake on LAN setting, duplex mode etc. It is helpful to have some information about a particular network adaptor, specially in checking the software for compatibility. It is not available by default in installation. So, you need to install it from repositories.

The Ethtool command retrieves the status of Ethernet interface and provides it as an argument.

Given below is an example:

[[email protected] ~]# ethtool eth0

Settings for eth0:
Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes

The output given above displays properties like speed, duplex, status and wake on for the etho interface.

There are three types of duplexes:

Full Duplex: Used when the Ethernet is connected to the switch. Allows two- way transfers, that is, sending and receiving of packets simultaneously.

Half Duplex: Used when the Ethernet is in connection with the hub. Allows only one- way transfers, that is, either sending or receiving of packets.

Auto negotiation: On the basis of the network connection, the Ethernet interface decides whether to use full or half duplex.

The Ethtool command can be set permanently with the Ethtool_opt variable. Let us have a look at the example given below:

[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
ETHTOOL_OPTS="speed 50 duplex full autoneg off"

You can test the above setting with ifup and ifdow commands.

The Ethernet driver settings and autonegotiation can be checked with the following commands:

[[email protected] ~]# ethtool -i eth0

driver: bnx2
version: 2.0.1-suse
firmware-version: 1.9.3
bus-info: 0000:04:00.0

[[email protected] ~]# ethtool –a eth0

Pause parameters for eth0:
Autonegotiate: on
RX: on
TX: on

The '–p option' of Ethtool command helps to identify specific device from multiple devices.

[[email protected] ~]# ethtool –p eth0

Having the statistics of network card is very useful in troubleshooting of network issues.

[[email protected] ~]# ethtool –S eth0

NIC statistics:
tx_packets: 148683
rx_packets: 179489
tx_errors: 0
rx_errors: 0
rx_missed: 0
align_errors: 0
tx_single_collisions: 0
tx_multi_collisions: 0
unicast: 116884
broadcast: 25361
multicast: 61674
tx_aborted: 0
tx_underrun: 0

The output above shows the details about the transferred and received packets.

Flow control in full duplex can be enabled by PAUSE parameter in latest MAC and GMAC embedded devices.

Here is the solution:

[[email protected] ~]#ethtool -A eth0 [autoneg on|off] [rx on|off] [tx on|off]

Offload parameters details can be obtained as follows:

[[email protected] ~]# ethtool –k eth0

However, any changes made in the Ethernet parameter settings will disappear at the time of the next boot. In order to have them intact in the next boot, you have to make these changes permanent by adding the command to /etc/rc.local

[[email protected] ~]#cat /etc/rc.local

ethtool -s eth0 speed 100 duplex full autoneg on 1>/dev/null 2>/dev/null
ethtool -s eth1 speed 100 duplex full autoneg on 1>/dev/null 2>/dev/null

Another example which sets the speed or duplex mode using ethtool command is as follows:

[[email protected] ~]# ethtool -s eth0 speed 100 duplex full
[[email protected] ~]# ethtool -s eth0 speed 10 duplex half

Bobbin Zachariah 11:27 pm

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.