Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

11.8. Ethtool

download PDF
Ethtool is a utility for configuration of Network Interface Cards (NICs). This utility allows querying and changing settings such as speed, port, auto-negotiation, PCI locations and checksum offload on many network devices, especially Ethernet devices.
We present here a short selection of often used ethtool commands together with some useful commands that are not well known. For a full list of commands type ethtool -h or see the man page, ethtool(8), for a more comprehensive list and explanation. The first two examples are information queries and show the use of the different formats of the command.
But first, the command structure:
ethtool [option...] devname
where option is none or more options, and devname is your Network Interface Card (NIC). For example eth0 or em1.
ethtool
The ethtool command with only a device name as an option is used to print the current settings of the specified device. It takes the following form:
ethtool devname
where devname is your NIC. For example eth0 or em1.
Some values can only be obtained when the command is run as root. Here is an example of the output when the command is run as root:
~]# ethtool em1
Settings for em1:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: No
	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: 1000Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 2
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: on
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes
Issue the following command, using the short or long form of the argument, to query the specified network device for associated driver information:
ethtool -i, --driver devname
where devname is your Network Interface Card (NIC). For example eth0 or em1.
Here is an example of the output:
~]$ ethtool -i em1
driver: e1000e
version: 2.0.0-k
firmware-version: 0.13-3
bus-info: 0000:00:19.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
Here follows a list of command options to query, identify or reset the device. They are in the usual -short and --long form:
--statistics
The --statistics or -S queries the specified network device for NIC and driver statistics. It takes the following form:
-S, --statistics devname
where devname is your NIC.
--identify
The --identify or -p option initiates adapter-specific action intended to enable an operator to easily identify the adapter by sight. Typically this involves blinking one or more LEDs on the specified network port. It takes the following form:
-p, --identify devname integer
where integer is length of time in seconds to perform the action,
and devname is your NIC.
--show-time-stamping
The --show-time-stamping or -T option queries the specified network device for time stamping parameters. It takes the following form:
-T, --show-time-stamping devname
where devname is your NIC.
--show-offload
The --show-features, or --show-offload, or -k option queries the specified network device for the state of protocol offload and other features. It takes the following form:
-k, --show-features, --show-offload devname
where devname is your NIC.
--test
The --test or -t option is used to perform tests on a Network Interface Card. It takes the following form:
-t, --test devname word
where word is one of the following:
  • offline — Perform a comprehensive set of tests. Service will be interrupted.
  • online — Perform a reduced set of tests. Service should not be interrupted.
  • external_lb — Perform full set of tests including loopback tests while fitted with a loopback cable.
and devname is your NIC.
Changing some or all settings of the specified network device requires the -s or --change option. All the following options are only applied if the -s or --change option is also specified. For the sake of clarity we will omit it here.
To make these settings permanent you can make use of the ETHTOOL_OPTS directive. It can be used in interface configuration files to set the desired options when the network interface is brought up. See Section 11.2.1, “Ethernet Interfaces” for more details on how to use this directive.
--offload
The --features, or --offload, or -K option changes the offload parameters and other features of the specified network device. It takes the following form:
-K, --features, --offload devname feature boolean
where feature is a built-in or kernel supplied feature,
boolean is one of ON or OFF,
and devname is your NIC.
The ethtool(8) man page lists most features. As the feature set is dependent on the NIC driver, you should consult the driver documentation for features not listed in the man page.
--speed
The --speed option is used to set the speed in megabits per second (Mb/s). Omitting the speed value will show the supported device speeds. It takes the following form:
--speed number devname
where number is the speed in megabits per second (Mb/s),
and devname is your NIC.
--duplex
The --duplex option is used to set the transmit and receive mode of operation. It takes the following form:
 --duplex word devname
where word is one of the following:
  • half — Sets half-duplex mode. Usually used when connected to a hub.
  • full — Sets full-duplex mode. Usually used when connected to a switch or another host.
and devname is your NIC.
--port
The --port option is used to select the device port . It takes the following form:
--port value devname
where value is one of the following:
  • tp — An Ethernet interface using Twisted-Pair cable as the medium.
  • aui — Attachment Unit Interface (AUI). Normally used with hubs.
  • bnc — An Ethernet interface using BNC connectors and co-axial cable.
  • mii — An Ethernet interface using a Media Independent Interface (MII).
  • fibre — An Ethernet interface using Optical Fibre as the medium.
and devname is your NIC.
--autoneg
The --autoneg option is used to control auto-negotiation of network speed and mode of operation (full-duplex or half-duplex mode). If auto-negotiation is enabled you can initiate re-negotiation of network speeds and mode of operation by using the -r, --negotiate option. You can display the auto-negotiation state using the --a, --show-pause option.
It takes the following form:
--autoneg value devname
where value is one of the following:
  • yes — Allow auto-negotiating of network speed and mode of operation.
  • no — Do not allow auto-negotiating of network speed and mode of operation.
and devname is your NIC.
--advertise
The --advertise option is used to set what speeds and modes of operation (duplex mode) are advertised for auto-negotiation. The argument is one or more hexadecimal values from Table 11.1, “Ethtool advertise options: speed and mode of operation”.
It takes the following form:
--advertise option devname
where option is one or more of the hexadecimal values from the table below and devname is your NIC.
Table 11.1. Ethtool advertise options: speed and mode of operation
Hex Value Speed Duplex Mode IEEE standard?
0x001 10
Half
Yes
0x002 10
Full
Yes
0x004 100
Half
Yes
0x008 100
Full
Yes
0x010 1000 Half No
0x020 1000
Full
Yes
0x8000 2500 Full Yes
0x1000 10000 Full Yes
0x20000 20000MLD2 Full No
0x20000 20000MLD2 Full No
0x40000 20000KR2 Full No
--phyad
The --phyad option is used to change the physical address. Often referred to as the MAC or hardware address but in this context referred to as the physical address.
It takes the following form:
--phyad physical_address devname
where physical_address is the physical address in hexadecimal format and devname is your NIC.
--xcvr
The --xcvr option is used to select the transceiver type. Currently only internal and external can be specified. In the future other types might be added.
It takes the following form:
--xcvr word devname
where word is one of the following:
  • internal — Use internal transceiver.
  • external — Use external transceiver.
and devname is your NIC.
--wol
The --wol option is used to set Wake-on-LAN options. Not all devices support this. The argument to this option is a string of characters specifying which options to enable.
It takes the following form:
--wol value devname
where value is one or more of the following:
  • p — Wake on PHY activity.
  • u — Wake on unicast messages.
  • m — Wake on multicast messages.
  • b — Wake on broadcast messages.
  • g — Wake-on-Lan; wake on receipt of a "magic packet".
  • s — Enable security function using password for Wake-on-Lan.
  • d — Disable Wake-on-Lan and clear all settings.
and devname is your NIC.
--sopass
The --sopass option is used to set the SecureOn password. The argument to this option must be 6 bytes in Ethernet MAC hexadecimal format (xx:yy:zz:aa:bb:cc).
It takes the following form:
--sopass xx:yy:zz:aa:bb:cc devname
where xx:yy:zz:aa:bb:cc is the password in the same format as a MAC address and devname is your NIC.
--msglvl
The --msglvl option is used to set the driver message-type flags by name or number. The precise meanings of these type flags differ between drivers.
It takes the following form:
--msglvl message_type devname
where message_type is one of:
  • message type name in plain text.
  • hexadecimal number indicating the message type.
and devname is your NIC.
The defined message type names and numbers are shown in the table below:
Table 11.2. Driver message type
Message Type Hex Value Description
drv 0x0001
General driver status
probe 0x0002
Hardware probing
link 0x0004
Link state
timer 0x0008
Periodic status check
ifdown 0x0010 Interface being brought down
ifup 0x0020
Interface being brought up
rx_err 0x0040 Receive error
tx_err 0x0080 Transmit error
intr 0x0200 Interrupt handling
tx_done 0x0400 Transmit completion
rx_status 0x0800 Receive completion
pktdata 0x1000 Packet contents
hw 0x2000 Hardware status
wol 0x4000 Wake-on-LAN status
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.