Few ways to check Network Interface details in Linux such as interface name, associated IP address, MAC address and interface speed etc.
ethtool command
The ethtool command is used to query or control network driver and hardware settings.
# sudo ethtool eth0
ip command
ip command is similar to ifconfig, which is used for assigning Static IP Address, Route & Default Gateway, etc.
# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether dc:ae:32:ea:8b:02 brd ff:ff:ff:ff:ff:ff inet 192.168.1.200/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 860207sec preferred_lft 860207sec inet6 fe80::efe8:791c:c224:8453/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 8e:a8:84:5c:60:d9 brd ff:ff:ff:ff:ff:ff permaddr dc:a6:32:ea:8b:03 4: hassio: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ea:94:f1:5c brd ff:ff:ff:ff:ff:ff inet 172.128.31.1/23 brd 172.30.33.255 scope global hassio valid_lft forever preferred_lft forever inet6 fe80::42:eaff:fe94:f15c/64 scope link valid_lft forever preferred_lft forever 5: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ea:02:d9:38 brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 valid_lft forever preferred_lft forever inet6 fe80::42:eaff:fe02:d938/64 scope link valid_lft forever preferred_lft forever
1) Checking available network interfaces
When you run the IP command without any argument, it gives you plenty of information about NIC, but use the following customized IP command to check only the network interfaces available on the system:
# ip a |awk '/state UP/{print $2}' eth0: hassio: docker0: veth23759a5@if6: veth33bc7f5@if8: vethcde2d48@if10: vethc70dc8c@if12: vethee53f1e@if14: veth1674490@if16: veth567be18@if18:
2) Checking IP address of the network interface
Run the below command to check the active network interface and the associated IP address:
# ip -o a show | cut -d ' ' -f 2,7 or # ip a |grep -i inet | awk '{print $7, $2}' lo 127.0.0.1/8 lo ::1/128 eth0 192.168.1.201/24 eth0 fe80::e22:791c:c224:8453/64 hassio 172.123.39.1/23 hassio fe80::42:eaff:fe94:f15c/64 docker0 172.32.22.1/16 docker0 fe80::42:eaff:fe02:d938/64 veth23759a5 fe80::b0f4:ccff:feab:64fb/64 veth33bc7f5 fe80::f478:91ff:fe2b:9748/64 vethcde2d48 fe80::9890:18ff:feb6:d869/64 vethc70dc8c fe80::5871:b7ff:fe8c:cc64/64 vethee53f1e fe80::b422:7ff:feb8:5751/64 veth1674490 fe80::84d8:21ff:fe48:8051/64 veth567be18 fe80::3475:6cff:fed5:97ab/64
3) Check the MAC address of the NIC
Run the below commands to check the active network interface and the associated MAC address.
To verify the specific network interface MAC address, run the below command:
# ip link show dev eth0 |awk '/link/{print $2}' dc:a6:32:b2:8b:11
4) Check speed of a network interface
Network interface port speed can only be verified in Linux using the ‘ethtool’ command.
To check the speed of a particular network interface port, use the following command:
# sudo ethtool eth0 |grep "Speed:" Speed: 10000Mb/s
That’s it, Enjoy