Jump to content

Ethtool: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
See also: add ref sect
Release info from Wikidata
Tags: Mobile edit Mobile web edit
 
(29 intermediate revisions by 22 users not shown)
Line 1: Line 1:
{{Multiple issues|
{{More citations needed|date=November 2020}}
{{One source|date=November 2020}}
}}
{{Lowercase title}}
{{Lowercase title}}
{{Infobox software
{{Infobox software
Line 9: Line 13:
|developer = Ben Hutchings
|developer = Ben Hutchings
|released = {{start date and age|1998}}
|released = {{start date and age|1998}}
|latest release version = {{wikidata|property|preferred|references|edit|P348|P548=Q2804309}}
|latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|P348|P548=Q2804309|P577}}|df=yes}}
|programming language = [[C (programming language)|C]]
|programming language = [[C (programming language)|C]]
|operating system = [[Linux]]
|operating system = [[Linux]]
|genre = Utility program
|genre = [[Computer networking|Networking]]
|license = [[GNU GPL]] v2
|license = [[GNU General Public License|GPLv2]]
|website = {{URL|https://www.kernel.org/pub/software/network/ethtool/}}
|website = {{URL|https://www.kernel.org/pub/software/network/ethtool/}}
}}
}}


'''ethtool''' is a utility for [[Linux kernel]]-based operating system for displaying and modifying some parameters of [[network interface controller]]s (NICs) and their [[device driver]]s. ethtool is developed parallel to the Linux kernel.
'''ethtool''' is the primary means in [[Linux kernel]]-based [[operating system]]s (primarily [[Linux]] and [[Android (operating system)|Android]]) for displaying and modifying the parameters of [[network interface controller]]s (NICs) and their associated [[device driver]] software from application programs running in [[User space|userspace]].

ethtool consists of two components, an [[API]] within the Linux kernel through which NICs can send and receive parameters through their device driver software, and a [[User space|userspace]] API based on the Linux SIOCETHTOOL [[ioctl]] mechanism through which application programs can communicate with the kernel to send and receive NIC and NIC driver parameters.

Most [[Linux distribution]]s provide a standard [[utility program]] called [https://man7.org/linux/man-pages/man8/ethtool.8.html ethtool] that can be used from a [[shell (computing)|shell]] to control, or gather information from NICs using the ethtool [[User space|userspace]] API. In the [[Information technology]] community, the term ''ethtool'' is usually used to refer to this utility program.

The ethtool [[User space|userspace]] API can be accessed from programs written in the [[C programming language|C]] and [[C++ programming language|C++]] [[programming language]]s through the [[C standard library]] or [[C++ standard library]] respectively.

Several [[scripting language]]s such as [[Perl]] and [[Python (programming language)|Python]] provide ethtool API [[language binding|binding]]s that allow programmers using these languages to write scripts that can control NIC's.

The [[macOS]] and [[FreeBSD]] operating systems provide utility programs that have a user interface similar to the Linux ethtool utility, but that use fundamentally different APIs to communicate with their operating system kernels and NIC's.


==Usage==
==Usage==
Line 22: Line 38:
* Identification and diagnosis of Ethernet devices
* Identification and diagnosis of Ethernet devices
* Extended Ethernet devices statistics
* Extended Ethernet devices statistics
* Control speed, duplex, auto-negotiation and flow control for Ethernet devices
* Control speed, duplex, [[autonegotiation]] and [[flow control (data)|flow control]] for Ethernet devices
* Control checksum offload and other hardware offload features
* Control [[checksum]] offload and other hardware offload features, such as [[large receive offload]] and [[large send offload]]
* Control [[Direct memory access|DMA]] ring sizes and interrupt moderation
* Control [[Direct memory access|DMA]] ring sizes and interrupt moderation
* Control receive queue selection for multiqueue devices
* Control receive queue selection for [[multiqueue NIC|multiqueue device]]s
* Upgrade firmware in flash memory
* Upgrade [[firmware]] in [[flash memory]]


== Examples ==
== Examples ==
To display the current parameters of the first network port ({{Mono|eth0}}):
To display the current parameters of the first network port ({{Mono|eth0}}):
<source lang="console">
<syntaxhighlight lang="console">
$ ethtool eth0
$ ethtool eth0
Settings for eth0:
Settings for eth0:
Supported ports: [ TP MII ]
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No
Advertised auto-negotiation: No
Line 50: Line 66:
Current message level: 0x00000007 (7)
Current message level: 0x00000007 (7)
Link detected: yes
Link detected: yes
</syntaxhighlight><ref>{{Cite web |date=2010-10-28 |title=9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card) |url=https://www.thegeekstuff.com/2010/10/ethtool-command/ |access-date=2020-11-14 |website=www.thegeekstuff.com}}</ref>
</source>


To force its speed and [[Duplex (telecommunications)|duplex]], in [[1000BASE-T]]:
To configure it with the 1000&nbsp;Mb/s speed and [[Duplex (telecommunications)|duplex]], in [[1000BASE-T]]:
<source lang="console">
<syntaxhighlight lang="console">
$ ethtool -s eth0 speed 1000 duplex full autoneg off
$ ethtool -s eth0 speed 1000 duplex full autoneg off
</syntaxhighlight>
</source>

To let the link light of the device eth0 flash for two minutes:
<syntaxhighlight lang="console">
$ ethtool -p eth0 120
</syntaxhighlight>To print the driver info of the interface eth0:<syntaxhighlight lang="console">
$ ethtool -i eth0
driver: mlx5_core
version: 4.9-2.2.4
firmware-version: 14.28.2006 (MT_2420110034)
expansion-rom-version:
bus-info: 0000:65:00.1
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes
</syntaxhighlight>

==mii-tool==
'''mii-tool''' is an older program performing a similar function to ethtool. Since 2003,<ref>{{cite web|url=http://lists.olug.org/pipermail/olug/2003-September/010415.html|title=Ethernet Auto-negotiation and Duplexing on Linux|website=lists.olug.org|date=September 2003}}</ref> it's considered obsolete and replaced by ethtool.

===Example===
To display the current parameters:
<syntaxhighlight lang="console">
$ mii-tool
eth0: no autonegotiation, 100baseTx-HD, link ok
</syntaxhighlight>
To force the network speed to 1&nbsp;Gbit/s, and the ''duplex'' in ''full'' on the port 1 (eth0):
<syntaxhighlight lang="console">
$ mii-tool -F 1000baseTx-FD eth0
$ mii-tool
eth0: 1 000 Mbit, full duplex, link ok
</syntaxhighlight>


==See also==
==See also==
{{Portal|Free software}}
{{Portal|Free and open-source software}}
* [[Iproute2]]
* [[iproute2]]
* [[mii-tool]]


==References==
==References==
Line 68: Line 116:
* {{Official website|https://www.kernel.org/pub/software/network/ethtool/}}
* {{Official website|https://www.kernel.org/pub/software/network/ethtool/}}
* [http://www.thegeekstuff.com/2010/10/ethtool-command/ Ethtool examples]
* [http://www.thegeekstuff.com/2010/10/ethtool-command/ Ethtool examples]
* [http://sourceforge.net/projects/net-tools/ Net Tools on sourceforge.net]


{{Unix commands}}
{{Unix commands}}
Line 73: Line 122:
[[Category:Linux network-related software]]
[[Category:Linux network-related software]]
[[Category:Linux configuration utilities]]
[[Category:Linux configuration utilities]]
[[Category:Linux-only software]]
[[Category:Linux-only free software]]
[[Category:Free network-related software]]
[[Category:Free network-related software]]


{{Network-software-stub}}

Latest revision as of 18:19, 17 July 2024

ethtool
Original author(s)David S. Miller
Developer(s)Ben Hutchings
Initial release1998; 26 years ago (1998)
Stable release
6.9[1] Edit this on Wikidata / 23 May 2024; 6 months ago (23 May 2024)
Repository
Written inC
Operating systemLinux
TypeNetworking
LicenseGPLv2
Websitewww.kernel.org/pub/software/network/ethtool/

ethtool is the primary means in Linux kernel-based operating systems (primarily Linux and Android) for displaying and modifying the parameters of network interface controllers (NICs) and their associated device driver software from application programs running in userspace.

ethtool consists of two components, an API within the Linux kernel through which NICs can send and receive parameters through their device driver software, and a userspace API based on the Linux SIOCETHTOOL ioctl mechanism through which application programs can communicate with the kernel to send and receive NIC and NIC driver parameters.

Most Linux distributions provide a standard utility program called ethtool that can be used from a shell to control, or gather information from NICs using the ethtool userspace API. In the Information technology community, the term ethtool is usually used to refer to this utility program.

The ethtool userspace API can be accessed from programs written in the C and C++ programming languages through the C standard library or C++ standard library respectively.

Several scripting languages such as Perl and Python provide ethtool API bindings that allow programmers using these languages to write scripts that can control NIC's.

The macOS and FreeBSD operating systems provide utility programs that have a user interface similar to the Linux ethtool utility, but that use fundamentally different APIs to communicate with their operating system kernels and NIC's.

Usage

[edit]

The command is useful for:

Examples

[edit]

To display the current parameters of the first network port (eth0):

$ ethtool eth0
Settings for eth0:
       Supported ports: [ TP MII ]
       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: No
       Speed: 100Mb/s
       Duplex: Full
       Port: MII
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: off
       Supports Wake-on: g
       Wake-on: g
       Current message level: 0x00000007 (7)
       Link detected: yes

[2]

To configure it with the 1000 Mb/s speed and duplex, in 1000BASE-T:

$ ethtool -s eth0 speed 1000 duplex full autoneg off

To let the link light of the device eth0 flash for two minutes:

$ ethtool -p eth0 120

To print the driver info of the interface eth0:

$ ethtool -i eth0
driver: mlx5_core
version: 4.9-2.2.4
firmware-version: 14.28.2006 (MT_2420110034)
expansion-rom-version: 
bus-info: 0000:65:00.1
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes

mii-tool

[edit]

mii-tool is an older program performing a similar function to ethtool. Since 2003,[3] it's considered obsolete and replaced by ethtool.

Example

[edit]

To display the current parameters:

$ mii-tool
eth0: no autonegotiation, 100baseTx-HD, link ok

To force the network speed to 1 Gbit/s, and the duplex in full on the port 1 (eth0):

$ mii-tool -F 1000baseTx-FD eth0
$ mii-tool
eth0: 1 000 Mbit, full duplex, link ok

See also

[edit]

References

[edit]
  1. ^ "ethtool - utility for controlling network drivers and hardware". Retrieved 17 July 2024.
  2. ^ "9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)". www.thegeekstuff.com. 2010-10-28. Retrieved 2020-11-14.
  3. ^ "Ethernet Auto-negotiation and Duplexing on Linux". lists.olug.org. September 2003.
[edit]