Home  >  Article  >  Operation and Maintenance  >  How to check which network cards are available in Linux

How to check which network cards are available in Linux

青灯夜游
青灯夜游Original
2022-03-21 14:57:5632011browse

How to check which network cards are available in Linux: 1. Use the "ifconfig -a" command to check; 2. Use the "cat /proc/net/dev" command to check; 3. Use "lspci | grep -i ' eth'" or "lspci | grep -i net" command to view.

How to check which network cards are available in Linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Check how many network cards the Linux system has

Method 1: Use ifconfig -a

ifconfig : The most commonly used command to configure and view network interface information. Executing this command on the server will get the content below. You can see multiple devices and device status and information in the following content.

[root@xuegod65 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:04:08:91  
          inet addr:192.168.1.250  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe04:891/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14454 errors:0 dropped:0 overruns:0 frame:0
          TX packets:961 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1174828 (1.1 MiB)  TX bytes:112979 (110.3 KiB)

eth1      Link encap:Ethernet  HWaddr 00:0C:29:04:08:9B  
          inet addr:192.168.240.1  Bcast:192.168.240.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe04:89b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:112 errors:0 dropped:0 overruns:0 frame:0
          TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9334 (9.1 KiB)  TX bytes:8366 (8.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Method 2: Use cat /proc/net/dev

[root@xuegod65 ~]# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 1190124   14635    0    0    0     0          0         0   119423     999    0    0    0     0       0          0
  eth1:    9334     112    0    0    0     0          0         0     8366      90    0    0    0     0       0          0

method 3: Use lspci | grep -i 'eth' or lspci | grep -i net

to list each pci bus After filtering through grep, you can get the network card device list

[oracle@mori ~]$ lspci |grep -i 'eth'
   02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
   02:06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
 
[oracle@mori ~]$ lspci | grep -i net
   02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
   02:06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to check which network cards are available in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn