Linux Ethtool Helps Troubleshooting Ethernet Network Cards Issues

Posted on : May 2, 2011 , Last Updated on : October 5, 2016 By
| Reply More

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:

[root@localhost ~]# 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
PHYAD: 1
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:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
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:

[root@localhost ~]# ethtool -i eth0

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

[root@localhost ~]# 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.

[root@localhost ~]# ethtool –p eth0

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

[root@localhost ~]# 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:

[root@localhost ~]#ethtool -A eth0 [autoneg on|off] [rx on|off] [tx on|off]

Offload parameters details can be obtained as follows:

[root@localhost ~]# 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

[root@localhost ~]#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:

[root@localhost ~]# ethtool -s eth0 speed 100 duplex full
[root@localhost ~]# ethtool -s eth0 speed 10 duplex half

Filed Under : LINUX HOWTO, NETWORK

Tagged With :

Free Linux Ebook to Download

Leave a Reply

All comments are subject to moderation.