Check Network Cards for Linux

Check Network Cards for Linux

April 7, 2022
network

The network interface controller (NIC). Also known as a network interface card, network adapter, LAN adapter or physical network interface, and so on. the following commands can be used for list NIC for linux.

Overview #

  1. lspci, List all PCI devices
  2. lshw, Linux identify Ethernet interfaces and NIC hardware.
  3. dmidecode, List all hardware data from BIOS.
  4. ifconfig, Outdated network config utility
  5. ip, Recommended new network config utility.
  6. hwinfo, Probe Linux for network cards.
  7. ethtool, A unified NIC/card driver and settings read/set utility on Linux.

Use lspci command Linux command to show list of network cards #

# lspci | egrep -i --color 'network|ethernet'
# lspci | egrep -i --color 'network|ethernet|wireless|wi-fi'

Sample output

00:14.3 Network controller: Intel Corporation Wireless-AC 9462
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (10) I219-V

use lshw command for displaying network cards #

The lshw command can extract detailed information on the hardware configuration of the machine including network cards.

# lshw -class network

Detailed hardware information about network cards on Linux:

  *-network:0
       description: Wireless interface
       product: Wireless-AC 9462
       vendor: Intel Corporation
       physical id: 14.3
       bus info: pci@0000:00:14.3
       logical name: wlp0s20f3
       version: 00
       serial: 08:6a:c5:1a:c3:4f
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.15.0-56-generic firmware=66.f1c864e0.0 QuZ-a0-hr-b0-66.u ip=192.168.2.32 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:ef3b8000-ef3bbfff
  *-network:1
       description: Ethernet interface
       product: Ethernet Connection (10) I219-V
       vendor: Intel Corporation
       physical id: 1f.6
       bus info: pci@0000:00:1f.6
       logical name: enp0s31f6
       version: 00
       serial: 90:2e:16:9e:5e:07
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.15.0-56-generic firmware=0.6-4 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:158 memory:ef380000-ef39ffff

Here is another outputs:

# lshw -class network -short

H/W path             Device          Class          Description
===============================================================
/0/100/14.3          wlp0s20f3       network        Wireless-AC 9462
/0/100/1f.6          enp0s31f6       network        Ethernet Connection (10) I219-V

Let us see mask, IP and other information set up for wlp82s0:

# ip a show wlp0s20f3

Linux ethtool command for Ethernet hardware devices #

Want to see/query or control network driver and hardware settings on Linux? Try the the ethtool command:

# ethtool wlp0s20f3

We can display driver information for network card too:

# ethtool -i wlp0s20f3

ifconfig and ip commands #

# ifconfig -a
# ip link show
# ip a

Want to list all IP addresses and interfaces on Linux in a tabular format for better readability? Try:

# ip -br -c link show
# ip -br -c addr show

Sample output

root@t14:~# ip -br -c link show
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
enp0s31f6        DOWN           90:2e:16:9e:5e:07 <NO-CARRIER,BROADCAST,MULTICAST,UP>
wlp0s20f3        UP             08:6a:c5:1a:c3:4f <BROADCAST,MULTICAST,UP,LOWER_UP>
ethd0            UNKNOWN        7e:64:e6:26:23:6b <BROADCAST,NOARP,UP,LOWER_UP>
tailscale0       UNKNOWN        <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP>
br-027b2ff940e1  UP             02:42:4c:34:1a:fc <BROADCAST,MULTICAST,UP,LOWER_UP>
docker0          DOWN           02:42:27:27:9c:f9 <NO-CARRIER,BROADCAST,MULTICAST,UP>
br-e9bfd79603f9  DOWN           02:42:a9:e2:7b:41 <NO-CARRIER,BROADCAST,MULTICAST,UP>
veth9b42bc5@if9  UP             5a:2f:99:ff:e3:a3 <BROADCAST,MULTICAST,UP,LOWER_UP>
veth5472d2d@if11 UP             f2:f2:09:d8:35:64 <BROADCAST,MULTICAST,UP,LOWER_UP>
veth222559f@if17 UP             32:cc:5d:d0:1f:ed <BROADCAST,MULTICAST,UP,LOWER_UP>
vethc051324@if21 UP             9a:44:cc:05:df:50 <BROADCAST,MULTICAST,UP,LOWER_UP>
vethd944bac@if25 UP             c2:e6:d2:9d:87:2b <BROADCAST,MULTICAST,UP,LOWER_UP>
veth0652c0f@if27 UP             ee:f4:f6:be:28:a0 <BROADCAST,MULTICAST,UP,LOWER_UP>
vethc3852bb@if35 UP             22:ca:60:0e:60:14 <BROADCAST,MULTICAST,UP,LOWER_UP>
veth54a4afc@if37 UP             5e:59:b6:fe:69:f0 <BROADCAST,MULTICAST,UP,LOWER_UP>
veth2824b9a@if39 UP             7e:b7:77:fc:44:32 <BROADCAST,MULTICAST,UP,LOWER_UP>
vethf4587f6@if41 UP             32:42:49:87:f3:d2 <BROADCAST,MULTICAST,UP,LOWER_UP>
veth74bb106@if43 UP             be:e2:44:37:8c:50 <BROADCAST,MULTICAST,UP,LOWER_UP>
root@t14:~#
root@t14:~#
root@t14:~#
root@t14:~# ip -br -c addr show
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp0s31f6        DOWN
wlp0s20f3        UP             192.168.2.32/24 fd03:6787:8246::1aa/128 fc00:8aa4:4c1a:1:7d1:d96d:564f:46b4/64 fc00:8aa4:4c1a:1:10f3:fc3a:c15f:c854/64 fd03:6787:8246:0:ac1b:60ed:f5d7:ff9f/64 fd03:6787:8246:0:5:5c83:1c74:2699/64 fe80::b96c:ad7f:28ed:e15f/64
ethd0            UNKNOWN        192.168.20.100/24 fe80::7c64:e6ff:fe26:236b/64
tailscale0       UNKNOWN        fe80::5bff:3e1f:727:9115/64
br-027b2ff940e1  UP             172.18.0.1/16 fe80::42:4cff:fe34:1afc/64
docker0          DOWN           172.17.0.1/16
br-e9bfd79603f9  DOWN           172.19.0.1/16
veth9b42bc5@if9  UP             fe80::582f:99ff:feff:e3a3/64
veth5472d2d@if11 UP             fe80::f0f2:9ff:fed8:3564/64
veth222559f@if17 UP             fe80::30cc:5dff:fed0:1fed/64
vethc051324@if21 UP             fe80::9844:ccff:fe05:df50/64
vethd944bac@if25 UP             fe80::c0e6:d2ff:fe9d:872b/64
veth0652c0f@if27 UP             fe80::ecf4:f6ff:febe:28a0/64
vethc3852bb@if35 UP             fe80::20ca:60ff:fe0e:6014/64
veth54a4afc@if37 UP             fe80::5c59:b6ff:fefe:69f0/64
veth2824b9a@if39 UP             fe80::7cb7:77ff:fefc:4432/64
vethf4587f6@if41 UP             fe80::3042:49ff:fe87:f3d2/64
veth74bb106@if43 UP             fe80::bce2:44ff:fe37:8c50/64
root@t14:~#

Listing network cards on Linux using hwinfo command #

# apt-get install 
# hwinfo --network --short

Sample output

network interface:
  wlp0s20f3            Ethernet network interface
  br-e9bfd79603f9      Ethernet network interface
  ethd0                Ethernet network interface
  tailscale0           Network Interface
  enp0s31f6            Ethernet network interface
  veth54a4afc          Ethernet network interface
  lo                   Loopback network interface
  veth2824b9a          Ethernet network interface
  vethc051324          Ethernet network interface
  veth74bb106          Ethernet network interface
  veth222559f          Ethernet network interface
  veth9b42bc5          Ethernet network interface
  vethd944bac          Ethernet network interface
  vethc3852bb          Ethernet network interface
  docker0              Ethernet network interface
  veth5472d2d          Ethernet network interface
  veth0652c0f          Ethernet network interface
  vethf4587f6          Ethernet network interface
  br-027b2ff940e1      Ethernet network interface

The /proc/net/dev file #

The dev pseudo-file contains network device status information. This gives the number of received and sent packets, the number of errors and collisions and other basic statistics.

# cat /proc/net/dev