How To Check Network Adapters Status in Linux

This post will guide you how to check network adapters status from the command line in your Linux Operating system. How do I show list of Network cards in your Linux. How to find Network adapters driver name and version on your Linux.

How To Check Network Adapters Status in Linux1

Checking Ethernet Network Card Status


If you want to check the status of an Ethernet Network interface in your Linux system, and you can type the following ethtool command at the shell prompt:

$ sudo ethtool NetworkInterfaceName
$ sudo ethtool enp0s3

Outputs:

[devops@mydevops ~]$ sudo ethtool enp0s3
Settings for enp0s3:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: off (auto)
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes

Displaying Network Card Driver Name and Version


If you want to find the name and version of a given network adapter in your current Linux system, and you need to pass the “-i” option to the ethtool command, type:

$ sudo ethtool -i enp0s3

Outputs:

[devops@mydevops ~]$ sudo ethtool -i enp0s3
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:00:03.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

Checking Network Card If It is UP or Down


If you want to check a particular network interface if it is up or down state in your Linux system, and you can use one of the following command:

$ sudo ip addr show enp0s3

or

$ sudo ethtool enp0s3 | grep "Link"

or

$ nmcli device status

Outputs:

[devops@mydevops ~]$ ip addr show enp0s3 | grep state
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000

[devops@mydevops ~]$ sudo ethtool enp0s3 | grep Link
Link detected: yes
[devops@mydevops ~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
enp0s3 ethernet connected enp0s3
virbr0 bridge connected virbr0
lo loopback unmanaged --
virbr0-nic tun unmanaged --

Displaying All Network Interfaces Infomation


If you want to display the information for all network interfaces in your system, and you can use the following command:

$ ifconfig -a

or

$ ip addr show

Outputs:

[devops@mydevops ~]$ ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.58 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::16e5:718:a1bb:4e82 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:f9:0a:aa txqueuelen 1000 (Ethernet)
RX packets 7764 bytes 2844890 (2.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2126 bytes 292517 (285.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:d8:9b:47 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:d8:9b:47 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[devops@mydevops ~]$ ip addr show
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:f9:0a:aa brd ff:ff:ff:ff:ff:ff
inet 192.168.3.58/24 brd 192.168.3.255 scope global dynamic noprefixroute enp0s3
valid_lft 75093sec preferred_lft 75093sec
inet6 fe80::16e5:718:a1bb:4e82/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:d8:9b:47 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:d8:9b:47 brd ff:ff:ff:ff:ff:ff

List all Network Card Names


If you want to list all Network Card Names in your Linux system, and you can type the following lshw command:

$ sudo lshw -class network  -short

Outputs:

[devops@mydevops ~]$ sudo lshw -class network -short
H/W path Device Class Description
=====================================================
/0/100/3 enp0s3 network 82540EM Gigabit Ethernet Controller
/1 virbr0-nic network Ethernet interface
/2 virbr0 network Ethernet interface

Conclusion


You should know that how to get the physical status of an ethernet card using ethtool/ip/ifconfig commands in your CentOS  or RHEL  Linux system.

You might also like:

Sidebar



back to top