My "Dedicated Server" should have two NICs installed but I can only find one.

My Question: What other commands and methods are available to test how many network cards are installed on my server

lspci | grep Ethernet

Are there any other commands / methods available?

  • Do you have physical access to the host? Can you confirm that any expansion cards are properly seated? Are all NIC's from the same manufacturer? – Tok Feb 24 '11 at 16:22
  • Hello Tok. Thanks for your answer.No the NIC's are not from the same manufacturer (one should be from intel and the other from realtek). =>Your question sounds interesting. What could be the effect/result if the cards are from different manufacturers? And I do not have physical access to the server and do not know if they are correctly installed. thanks. jens. – jens Feb 24 '11 at 18:01

You can use lshw to see all devices on a machine. To view just the network devices enter:

lshw -class network
  • 4
    lshw is not part of a default Debian setup. – Jean-Marc Liotier Sep 13 '11 at 23:56
  • 1
    I find this a bit too much, I'll rather just: ip link show – Matías Nov 3 '14 at 15:24
  • This also display the bridge interfaces, which are not physicals. – Xorax Sep 29 '17 at 19:20

For Ethernet:

ls -d /sys/class/net/eth* | wc -l
  • 1
    This does not work in general because ethernet device names do not have to start with eth. Many (all?) major linux distros are now using "predictable ethernet interface names" with systemd, resulting in wired interface names like en0 or enp0s25, so looking for eth* will miss those. – rajb245 Jan 30 '18 at 15:44
  • 2
    Give this a try: $ ls -l /sys/class/net/ | grep -v virtual. It filters all virtual network interfaces out. Work on ubuntu running in a Virtual Box. – kwarnke May 15 '18 at 11:11

ip link show will list everything that looks like a network interface.

find /sys/class/net -type l -not -lname '*virtual*' -printf '%f\n'

Shows just interfaces that relate to a physical NIC.

Tried to find a type option to ip link show that would display non-logical, but alas:

ip link help 2>&1 | grep -A10 'TYPE :='
TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |
          bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |
          gre | gretap | ip6gre | ip6gretap | vti | nlmon |
          bond_slave | ipvlan | geneve | bridge_slave | vrf }

It seems to be the one thing that ip link show cannot do. At least not without resorting to a script that first lists each of the above and then does grep -v against a final run without type specified.

  • This definitely seems like something ip link should be able to handle. If using a lot of virtual interfaces (say for bridging or vlan) and especially if these virtual interfaces have been renamed. – Centimane Dec 5 '17 at 17:37

/proc/net/dev file has details on all interfaces. e.g.

$ 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:    3562      60    0    0    0     0          0         0     3562      60    0    0    0     0       0          0
 wlan0: 2491781197 2034240    0    0    0     0          0         0 261797069 1502752    0    0    0     0       0          0
  eth0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

As you can see, many columns and details are not very easy to read when you cat the file so I would suggest to use ifconfig command which reads that file and formats output nicely.

To list all interfaces use

/sbin/ifconfig -a

that will show you the unconfigured/down network interfaces as well as configured and active ones, as read from /proc/net/dev

modprobe -c |grep 'eth[0-9]'

shows the real device driver in use for each ethernet device

  • ...but ethernet devices may be named differently – Joril Jul 5 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.