Rack servers are designed to support enterprise-grade systems and operations. Unlike regular servers, rack servers must be resilient and usually contain several physical Ethernet ports or Network Interface Cards (NICs) to be able to connect to several networks at once.

Apart from rack servers, some industrial or specialized PCs also come with multiple Ethernet ports or NICs.

Whatever the case, here's how you can find out the number of Ethernet ports on a Linux server without physically going to the server room to inspect.

Why Do Servers Have Multiple Physical Ethernet Ports?

Most rack servers or industrial PCs have multiple Network Interface Cards (NICs) for the following reasons:

  • Network segmentation: Multiple physical ports allow a server to connect to several networks at once. This provides better security and performance.
  • Virtualization: Virtualization is key to ensuring that your server is utilizing the resources optimally. It also allows you to run different types of network servers on a single hardware server. Having multiple interfaces also allows for virtually segmenting VM networks.
  • Redundancy: Multiple physical interfaces make your server network more resilient because you can still contact your server when a single cable or interface experiences a hardware failure.

Overall, multiple network interfaces in your server network provide better performance and robustness.

Listing Physical Ethernet Ports on Your Linux Server

The lspci command lists all Peripheral Component Interconnect (PCI) devices on your machine. PCI is a standard protocol that allows computers to connect and communicate via physical interfaces such as NICs, video cards, etc.

Since we are only interested in Ethernet ports, filter the listing accordingly using the grep command as follows:

         lspci | grep -i ethernet
    
listing physical ethernet ports on a linux server

The output list all the NICs on this server; as you can see, there are eight in total. In addition to listing the NICs, you'll also get the manufacturer of the NIC and its type: Ethernet, in this case.

To only show the total number of ports without a detailed listing, use the following command:

        lspci | grep Ethernet | wc -l
    

Mastering Linux Server Administration

Servers that come with multiple physical Ethernet ports offer better performance and are more robust and resilient in comparison to PCs that only come with a single NIC.

Linux comes with many built-in tools, such as the ip command, for configuring and managing your network.