How to list all physical Ethernet ports on Linux server
In addition to rack servers, some industrial or dedicated PCs also come with multiple Ethernet or NIC ports.
Either way, here's how you can find out the number of Ethernet ports on a Linux server without going to the server room to check.
Why does the server have multiple physical Ethernet ports?
Most rack servers or industrial PCs have multiple NICs (Network Interface Cards) for the following reasons:
- Network segmentation : Multiple physical ports allow the server to connect to multiple networks at the same time. This provides better security and performance.
- Virtualization : Virtualization is key to ensuring that your server is using resources optimally. It also allows you to run different types of network servers on a single hardware server. Having multiple interfaces also allows virtual segmentation of virtual machine networks.
- Redundancy : Multiple physical interfaces make your server network more resilient because you can still contact your server when a cable or interface has hardware problems.
In general, multiple network interfaces in your server network provide better performance and more robustness.
List physical Ethernet ports on Linux server
The lspci command lists all the PCI (Peripheral Component Interconnect) devices on your machine. PCI is a standard protocol that allows computers to connect and communicate through physical interfaces such as NICs, video cards, etc.
Since we are only interested in Ethernet ports, filter the list accordingly using the grep command as follows:
lspci | grep -i ethernet
How to list all physical Ethernet ports on Linux server Picture 1
The output lists all the NICs on this server (as you can see, there are 8 NICs in total). In addition to listing the NICs, you'll also know the NIC's manufacturer and its type: Ethernet, in this case.
To display only the total number of ports without a detailed list, use the following command:
lspci | grep Ethernet | wc -l
Secure Linux server administration rights
Servers that come with multiple physical Ethernet ports offer better performance, power, and flexibility than PCs that come with only one NIC.
Linux comes with many built-in tools, such as the ip command, to configure and manage your network.
You should read it
- How to Open Ports in Linux Server Firewall
- The 5 best Linux server distributions
- 7 Enterprise Linux Server Distributions
- Should I use WiFi or Ethernet and why?
- How to set up your own Git server on Linux
- Difference between Ethernet and LAN
- 12 best Linux server operating systems
- How to check open ports in Linux
- How to manage remote Linux server using SSH
- New points in SQL Server 2017
- How is wired (Ethernet) better than wireless (Wi-Fi)?
- How to access Linux server from Android
May be interested
Ubuntu 23.04 'Lunar Lobster' Beta Launched: What's Notable
How to Run Linux Commands on Windows with WSL 2
How to use ChatGPT from Ubuntu Terminal using ShellGPT
How to play Solitaire in Linux terminal with solitaire-ti
What is a package dependency in Linux?
How to Create an ARM-Based Linux Virtual Machine with Azure