Linux command tips : ethtool

bash

Introduction

This “Bash command¬† tips” page is about the ethtool command. This post is not supposed to be exhaustive, its purpose is to show some tips regarding the ethtool command; I will update this page each time i found something interesting.

 

Command information

  • Purpose : display and set network interface settings
  • Required privileges¬† : root
  • Default path (RHel based distros) : /sbin/ethtool
  • Used version in this post : ethtool version 6
  • Exit code : 0=Success, non-zero=Failure

 

 

1 ethtool command general syntax

The general syntax of the ethtool command is as follows.

ethtool <options> <interface_name>

 

2 Display general information about network interface

The simpler form of the ethtool command can be used to get general information about a given network interface.

ethool <interface_name>

2.1 Example and output

[root@server ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 2
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on
        Supports Wake-on: pumbag
        Wake-on: g
        Current message level: 0x00000001 (1)
        Link detected: yes
[root@server ~]#

 

3 Check the firmware and driver version of your network card(s)

This can be easily done using the following command.

ethtool -i <interface_name>

3.1 Example and output

[root@server ~]# ethtool -i eth0
driver: e1000e
version: 1.0.2-k3
firmware-version: 0.5-3
bus-info: 0000:00:19.0
[root@server ~]#

 

4 Set wake-on-lan

Wake-on-lan can be activated using the ethtool command. You may first need to check the supported type of wake-on-lan by issuing the command as seen here, once you get the possible wake-on-lan, you can set it up using the following :

ethtool -s <interface_name> wol <one_of_the_possible_value>

4.1 Example and output

Before we setup the wake-on-lan value :

[root@server ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 2
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on
        Supports Wake-on: pumbag
        Wake-on: d
        Current message level: 0x00000001 (1)
        Link detected: yes
[root@server ~]#

The d value means “disabled”, with this configuration the wake-on-lan function is de-activated.

Let’s set it up to one of the possible value (pumbag in this very case) :

ethtool -s eth0 wol g

We now check if the setting has been activated :

[root@server ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 2
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on
        Supports Wake-on: pumbag
        Wake-on: g
        Current message level: 0x00000001 (1)
        Link detected: yes
[root@server ~]#

As we can see the wake-on is now set to g value (which means “magic packet”).

Note : The above procedure to activate wake-on-lan will not stay upon reboot, if you want to keep the wake-on-lan activated upon reboot you should edit the /etc

 

5 wake-on-lan possible values

This list is an excerpt from man ethtool.

              p  Wake on phy activity
              u  Wake on unicast messages
              m  Wake on multicast messages
              b  Wake on broadcast messages
              a  Wake on ARP
              g  Wake on MagicPacket(tm)
              s  Enable SecureOn(tm) password for MagicPacket(tm)
              d  Disable (wake on nothing).  This option clears all previous

 

Resources

  • man ethtool

 

More “Linux command tips” posts

Leave a Reply

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

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.