Beruflich Dokumente
Kultur Dokumente
Home
Free eBook
Contact
About
Start Here
12 Like 17 Tweet 18
When you execute ethtool command with a device name, it displays the following information about the
ethernet device.
# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
http://www.thegeekstuff.com/2010/10/ethtool-command/ 1/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Link detected: yes
This above ethtool output displays ethernet card properties such as speed, wake on, duplex and the link
detection status. Following are the three types of duplexes available.
Full duplex : Enables sending and receiving of packets at the same time. This mode is used when
the ethernet device is connected to a switch.
Half duplex : Enables either sending or receiving of packets at a single point of time. This mode is
used when the ethernet device is connected to a hub.
Auto-negotiation : If enabled, the ethernet device itself decides whether to use either full duplex or
half duplex based on the network the ethernet device attached to.
The above ethtool eth0 output displays that the “Auto-negotiation” parameter is in enabled state. You can
disable this using autoneg option in the ethtool as shown below.
# ifdown eth0
eth0 device: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
eth0 configuration: eth-bus-pci-0000:0b:00.0
# 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: Not reported
Advertised auto-negotiation: No
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
http://www.thegeekstuff.com/2010/10/ethtool-command/ 2/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
Wake-on: g
Link detected: no
# ifup eth0
After the above change, you could see that the “link detection” value changed to down and auto-
negotiation is in off state.
Using ethtool you can change the speed of the ethernet device to work with the certain network devices,
and the newly assign speed value should be within the limited capacity.
# 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: Not reported
Advertised auto-negotiation: No
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: g
Link detected: no
Once you change the speed when the adapter is online, it automatically goes offline, and you need to
bring it back online using ifup command.
# ifup eth0
eth0 device: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
eth0 configuration: eth-bus-pci-0000:0b:00.0
http://www.thegeekstuff.com/2010/10/ethtool-command/ 3/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
# 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: Not reported
Advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: g
Link detected: yes
As shown in the above output, the speed changed from 1000Mb/s to 100Mb/s and auto-negotiation
parameter is unset.
To change the Maximum Transmission Unit (MTU), refer to our ifconfig examples article.
ethtool -i option displays driver version, firmware version and bus details as shown below.
# ethtool -i eth0
driver: bnx2
version: 2.0.1-suse
firmware-version: 1.9.3
bus-info: 0000:04:00.0
View the autonegotiation details about the specific ethernet device as shown below.
# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate: on
RX: on
TX: on
Use ethtool -S option to display the bytes transfered, received, errors, etc, as shown below.
# ethtool -S eth0
NIC statistics:
rx_bytes: 74356477841
rx_error_bytes: 0
http://www.thegeekstuff.com/2010/10/ethtool-command/ 4/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
tx_bytes: 110725861146
tx_error_bytes: 0
rx_ucast_packets: 104169941
rx_mcast_packets: 138831
rx_bcast_packets: 59543904
tx_ucast_packets: 118118510
tx_mcast_packets: 10137453
tx_bcast_packets: 2221841
tx_mac_errors: 0
tx_carrier_errors: 0
rx_crc_errors: 0
rx_align_errors: 0
tx_single_collisions: 0
tx_multi_collisions: 0
tx_deferred: 0
tx_excess_collisions: 0
tx_late_collisions: 0
tx_total_collisions: 0
rx_fragments: 0
rx_jabbers: 0
rx_undersize_packets: 0
rx_oversize_packets: 0
rx_64_byte_packets: 61154057
rx_65_to_127_byte_packets: 55038726
rx_128_to_255_byte_packets: 426962
rx_256_to_511_byte_packets: 3573763
rx_512_to_1023_byte_packets: 893173
rx_1024_to_1522_byte_packets: 42765995
rx_1523_to_9022_byte_packets: 0
tx_64_byte_packets: 3633165
tx_65_to_127_byte_packets: 51169838
tx_128_to_255_byte_packets: 3812067
tx_256_to_511_byte_packets: 113766
tx_512_to_1023_byte_packets: 104081
tx_1024_to_1522_byte_packets: 71644887
tx_1523_to_9022_byte_packets: 0
rx_xon_frames: 0
rx_xoff_frames: 0
tx_xon_frames: 0
tx_xoff_frames: 0
rx_mac_ctrl_frames: 0
rx_filtered_packets: 14596600
rx_discards: 0
rx_fw_discards: 0
When there is a problem with the network connection, you might want to check (or change) the ethernet
device parameters explained in the above examples, when you see following issues in the output of
ethtool command.
Upon successful connection, the three parameters mentioned above gets appropriate values. i.e Speed is
http://www.thegeekstuff.com/2010/10/ethtool-command/ 5/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
assigned with known value, Duplex become either Full/Half, and the Link detection becomes Yes.
After the above changes, if the Link Detection still says “No”, check whether there are any issues in the
cables that runs from the switch and the system, you might want to dig into that aspect further.
To capture and analyze packets from a specific network interface, use tcpdump utility.
8. Identify Specific Device From Multiple Devices (Blink LED Port of NIC Card)
Let us assume that you have a machine with four ethernet adapters, and you want to identify the physical
port of a particular ethernet card. (For example, eth0).
Use ethtool option -p, which will make the corresponding LED of physical port to blink.
# ethtool -p eth0
If you’ve changed any ethernet device parameters using the ethtool, it will all disappear after the next
reboot, unless you do the following.
On ubuntu, you have to modify /etc/network/interfaces file and add all your changes as shown below.
# vim /etc/network/interfaces
post-up ethtool -s eth2 speed 1000 duplex full autoneg off
The above line should be the last line of the file. This will change speed, duplex and autoneg of eth2
device permanently.
On SUSE, modify the /etc/sysconfig/network/ifcfg-eth-id file and include a new script using
POST_UP_SCRIPT variable as shown below. Include the below line as the last line in the corresponding
eth1 adpater config file.
# vim /etc/sysconfig/network/ifcfg-eth-id
POST_UP_SCRIPT='eth1'
Then, create a new file scripts/eth1 as shown below under /etc/sysconfig/network directory. Make sure
that the script has execute permission and ensure that the ethtool utility is present under /sbin directory.
# cd /etc/sysconfig/network/
# vim scripts/eth1
#!/bin/bash
/sbin/ethtool -s duplex full speed 100 autoneg off
http://www.thegeekstuff.com/2010/10/ethtool-command/ 6/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
Its awesome!!!
http://www.thegeekstuff.com/2010/10/ethtool-command/ 7/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
Thanks,
Ritesh
Is it possible to clear the Statistics collected from “ethtool -S ethX” without rebooting the Host ?
On SuSE, you can add ethtool commands directly to the “ifcfg-ethX” file.
For example, edit:
/etc/sysconfig/network/ifcfg-eth0
and add:
ETHTOOL_OPTIONS=’speed 100 duplex full autoneg off’
Usually, the variable exist but is blank:
ETHTOOL_OPTIONS=”
bb
“post-up ethtool -s eth2 speed 1000 duplex full autoneg off” <- this is incorrect.
AFAIK, autonegotiation is a required part of the standard for GigE 1000 Base-T (or so says the
IEEE standard).
i have a problem in wake on lan . i can`t change the port of the wake on lan so please give me
solution
I tried out the ‘-p’ option in my laptop (just one Ethernet ) and my system crashed totally but the
LED was blinking after all. I have to try it out on different systems.
http://www.thegeekstuff.com/2010/10/ethtool-command/ 8/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
Congratulations
Hi Balakrishnan,
what is meant by PHYAD ,MDI-X ,Wake-on :d
Thank you!
Leave a Comment
Name
Website
Submit
Search
http://www.thegeekstuff.com/2010/10/ethtool-command/ 9/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
-69% -69%
COURSE
Linux Sysadmin CentOS 6 Course - Master the Tools, Configure it Right, and be Lazy
EBOOKS
Linux 101 Hacks 2nd Edition eBook - Practical Examples to Build a Strong
Foundation in Linux
Bash 101 Hacks eBook - Take Control of Your Bash Command Line and Shell Scripting
Sed and Awk 101 Hacks eBook - Enhance Your UNIX / Linux Life with Sed and Awk
Vim 101 Hacks eBook - Practical Examples for Becoming Fast and Productive in Vim Editor
Nagios Core 3 eBook - Monitor Everything, Be Proactive, and Sleep Well
The Geek Stuff
Like
POPULAR POSTS
12 Amazing and Essential Linux Books To Enrich Your Brain and Library
50 UNIX / Linux Sysadmin Tutorials
50 Most Frequently Used UNIX / Linux Commands (With Examples)
How To Be Productive and Get Things Done Using GTD
30 Things To Do When you are Bored and have a Computer
Linux Directory Structure (File System Structure) Explained with Examples
http://www.thegeekstuff.com/2010/10/ethtool-command/ 10/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
CATEGORIES
Linux Tutorials
Vim Editor
Sed Scripting
Awk Scripting
Bash Shell Scripting
Nagios Monitoring
OpenSSH
IPTables Firewall
Apache Web Server
MySQL Database
Perl Programming
Google Tutorials
Ubuntu Tutorials
PostgreSQL DB
Hello World Examples
C Programming
C++ Programming
DELL Server Tutorials
Oracle Database
http://www.thegeekstuff.com/2010/10/ethtool-command/ 11/12
11/18/2014 9 Linux ethtool Examples to Manipulate Ethernet Card (NIC Card)
VMware Tutorials
Ramesh Natarajan
Follow
Support Us
Contact Us
Email Me : Use this Contact Form to get in touch me with your comments, questions or
suggestions about this site. You can also simply drop me a line to say hello!.
Follow us on Google+
Follow us on Twitter
http://www.thegeekstuff.com/2010/10/ethtool-command/ 12/12