How to tell the network speed of network cards in Linux?
CentOS 7
Find the network cards:
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:0c:29:d5:dc:4a brd ff:ff:ff:ff:ff:ff inet 216.55.xxx.xxx/24 brd 216.55.169.255 scope global ens160 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fed5:dc4a/64 scope link valid_lft forever preferred_lft forever 3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:0c:29:d5:dc:54 brd ff:ff:ff:ff:ff:ff inet 192.168.1.101/24 brd 192.168.1.255 scope global ens192 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fed5:dc54/64 scope link valid_lft forever preferred_lft forever
Ethtool
# ethtool ens160 Settings for ens160: Supported ports: [ TP ] Supported link modes: 1000baseT/Full 10000baseT/Full Supported pause frame use: No Supports auto-negotiation: No Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Speed: 10000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: off MDI-X: Unknown Supports Wake-on: uag Wake-on: d Link detected: yes
# ethtool ens160 | grep Speed Speed: 10000Mb/s
Script:
for i in $(netstat -i | cut -f1 -d" " | tail -n+3) ; do echo "$i: $(ethtool "$i" | grep Speed | sed 's/Speed://g')" ; done
cat /sys/class/net/<interface>/speed
# cat /sys/class/net/ens160/speed 10000
Above would be in MB.
DMESG
# dmesg |grep eth0 [0.932304] vmxnet3 0000:03:00.0 eth0: NIC Link is Up 10000 Mbps