I just installed a new gigabit network interface card (NIC) in Linux. How do I tell if it is really set to gigabit speeds? I see ethtool
has an option to set the speed, but I can't seem to figure out how to report its current speed.
I just installed a new gigabit network interface card (NIC) in Linux. How do I tell if it is really set to gigabit speeds? I see ethtool
has an option to set the speed, but I can't seem to figure out how to report its current speed.
Just use a command like:
ethtool eth0
to get the needed info. Ex:$ sudo ethtool eth0 | grep Speed
It is possible to use the information from the kernel when ethtool is missing:
Example for interface named eth0:
NOTE: the man page for
mii-tool
has this disclaimer:Use
mii-tool
to watch the negotiated network speed.Ex.
There are some great answers here, I just wanted to add a few more options.
1. I know this is not quite what you asked (read on for other ways). But if you want to know the real world performance of your NIC, rather than what your computer says it should be, you can use iperf. I usually do this - because you never know. I bought a 1Gb NIC recently that that only transferred at 672Mbps but it's uplink was 1Gb. Good thing I checked.
You'll need two computers.
On computer one, run iperf in server mode:
On the other, run iperf in client mode:
If you want to see the full duplex speed, try this instead:
Substitute 192.168.0.10 for the servers IP address
2. On Ubuntu systems,
/var/log/kern.log
has limited logging of kernel events. It will record link speed and status of a NIC when it changes. I'm sure other distributions probably do something similar or can be setup to do so.3. You'll probably never, ever need to go this far, but you can write c code that to get the speed. Tested working and root is not required.
https://stackoverflow.com/questions/2872058/get-link-speed-programmatically
As Khaled mentioned, you should be able to run ethtool with just the interface as an argument. This will list the supported speeds, the advertised speeds, the current speed, and a bunch of other things too:
You can also run
dmesg
, and grep for your interface, but this might not work if your system has been running for a long time and the current buffer no longer has that information (in that case, you'll have to grep the older /var/log/dmesg.* files):Use below command
refer this
Also for future reference I've noticed that the speed field in ethtool gives the maximum speed supported by the NIC and mii-tool give the actual speed on which the NIC is running.
UPDATE: After a while a found out the mii-tool wasn't returning the right speed as it was outdated and deprecated and ethtool was returning the negotiated speed.
ethtool eth0
worked for me. Example: