Categories
How-To Software Technical

Show List Of Network Cards in Linux

Here is a question I got not so long ago.

Jermal, How do I go about finding the name and type of network card I have in my Linux installation?

First off, thanks for asking me. I know of a few ways and I’ll list them here. Short and simple. We have the the following commands: ip, ifconfig, lspci, dmidecode, lshw commands. Out of these I only use 3.

ifconfig and ip commands

root@websvr:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0c:29:f2:1f:55
 inet addr:10.255.255.10 Bcast:10.255.255.255 Mask:255.255.255.0
 inet6 addr: fe80::20c:29ff:fef2:1f55/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:1234097 errors:0 dropped:119 overruns:0 frame:0
 TX packets:847638 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:177921015 (177.9 MB) TX bytes:359121554 (359.1 MB)
 Interrupt:18 Base address:0x2024
root@websvr:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
 link/ether 00:0c:29:f2:1f:55 brd ff:ff:ff:ff:ff:ff
root@websvr:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
 inet6 ::1/128 scope host
 valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
 link/ether 00:0c:29:f2:1f:55 brd ff:ff:ff:ff:ff:ff
 inet 10.255.255.10/24 brd 10.255.255.255 scope global eth0
 inet6 fe80::20c:29ff:fef2:1f55/64 scope link
 valid_lft forever preferred_lft forever

lshw command is another nice one also

root@websvr:~# lshw -class network
 *-network
 description: Ethernet interface
 product: 79c970 [PCnet32 LANCE]
 vendor: Hynix Semiconductor (Hyundai Electronics)
 physical id: 0
 bus info: pci@0000:02:00.0
 logical name: eth0
 version: 10
 serial: 00:0c:29:f2:1f:55
 size: 1Gbit/s
 capacity: 1Gbit/s
 width: 32 bits
 clock: 33MHz
 capabilities: bus_master rom ethernet physical logical tp 1000bt-fd
 configuration: autonegotiation=off broadcast=yes driver=vmxnet driverversion=2.0.12.0 duplex=full firmware=N/A ip=10.255.255.10 latency=64 link=yes maxlatency=255 mingnt=6 multicast=yes port=twisted pair speed=1Gbit/s
 resources: irq:18 ioport:2000(size=128) memory:dc400000-dc40ffff

And when feeling a bit fancy you could toss in the lspci command with egrep

root@websvr:~# lspci | egrep -i --color 'network|ethernet'
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)

And… that is about it. I hope this answers your question

– Jermal