In many occasions, we may need to find the Model number, Driver version, Firmware version and other features of a Network Interface Card (NIC) which is already installed on your Linux Server. Rarely, you may also need to find MAC Address, Network Statistics and Hardware Settings of NIC Card as well. In this article, we will discuss different commands which can be used to find all these information.
Let us start by finding the Network Card model number and chipset used in it. This information can be handy when you want to download a driver for the Network Card or you wanted to check whether the NIC card is supported by your Linux Operating System. Whatever your needs are, below said method should help you.
Find the Model Number of Network Card in Linux:
To find the model number of Network Interface Card installed in your Machine, you can use the lspci command. lspci command will list all detected PCI or PCIe hardware devices installed on your machine. So in order to find only network cards, you can run following command:
lspci | grep -i “Ethernet”
I tried above said command in my Linux Server and got the following results. It looks like the network card uses the BCM5709 chip from Broadcom. When you run the same command in your linux box, you should see something similar to this.
NOTE: lspci command may not be available by default on all Linux machines. lspci is part of pciutils package and if you are using Redhat, CentOS or Fedora, then you need to run yum install pciutils command to install this tool. If you are using Ubuntu or Debian, then use the command apt-get install pciutils to enable lspci command.
lspci command provides very detailed information about all PCIbuses and devices in the system. So if you need detailed information about the NIC card, then we can specify more options to the lspci command. Go ahead and try the command:
lspci -v | grep Ethernet -A 1
This command will list the actual name of the network adapter next to “Subsystem”. I ran above said command on my Linux machine and got the below provided result. From the result, I understand that my NIC Card model is HP NC382i NIC Adapter from Hewlett-Packard and the chipset used is Broadcom BCM5709.
Well, if you are greedy like me and would like to have lot more information about the network interface card installed in your machine, then you go ahead and run below said command:
lspci -v | grep Ethernet -A 20
Holy cow!, it pulled hell lot of information about my NIC card. Here I can find Chipset, Model number, NIC Driver information, Buffer size and different capabilities of the NIC card. If you run the above said command in your machine, you should see something similar to this (Please check the screenshot provided below).
Another way to find hardware information is by using lshw command. By default, lshw command is not available on your Fedora, CentOS, Ubuntu, Debian or RedHat system. To install lshw, you need to setup right repository using YUM or apt-get. Once you configured repository, run the command apt-get install lshw for Ubuntu or Debian Linux. If you are using CentOS, RedHat and Fedora, then run the commandyum install lshw . Once lshw is installed, go ahead and run the command:
lshw -class network
Find the Driver and Firmware of Network Card in Linux:
Here, we will discuss how to find Network Card Driver and firmware version in Linux. As you know that, NIC manufactures often release newer drivers and firmware for the NIC cards. Very often these drivers and firmware solves variety of bugs reported ewith the NIC card. So in many occasion, we may need to find the existing version of NIC driver and the current firmware of NIC card. In Linux, we can easily find this information by using ethtool command.
I assume that your machine have at-least one Network Interface Card (NIC) available and the name of the NIC is eth0. Now try the command:
ethtool -i eth0
I ran the ethtool -i eth0 command in my machine and got the following results (you may check the screenshot). From the results, I understand that NIC card is currently using “bnx2 driver version 2.2.3” and firmware of NIC card is 5.2.3. Moreover I found information related to Broadcom NIC here.
NOTE: ethtool may not be installed by default on your Fedora, CentOS, Ubuntu, Debian or RedHat system. To install ethtool on your Fedora, CentOS or RedHat machine, run the commandyum install ethtool and if you are using Ubuntu or Debian Linux, you could run the command apt-get install ethtool.
If above said command does not work, we can use you dmesg command. In Linux, dmesg command will display the system message buffer and helps to view log messages related to the most recent Linux system start-up. So let us see what dmesg found at the system start-up regarding the NIC card. Run below provided command:
dmesg | grep “Ethernet Driver”
Once I executed the command, you can find that I use a Broadcom NIC chipset, the driver is bnx2, driver version is 2.2.3 and driver date is June 27, 2012.
Another way to find driver information is to check the /var/log/messages. The /var/log/messages file contains all system related messages that are logged during system startup. There is a good chance this file would contain information about the network card. Run below said command.
grep “Ethernet Driver” /var/log/messages
Check the result displayed on my System. You could find the device driver name, driver date and version of driver.
Find NIC Link Status and Duplex information in Linux:
Let us try to find the Link status and Duplex information of the Network Card. To check the link status and driver information of the NIC card, you could go ahead and try the command provided below.
dmesg | grep -i duplex
I ran above said command and here is the output of above said command.
You could also use mii-tool to find the NIC link status. Run below said command:
mii-tool eth0
How to find MAC Address of the NIC Card in Linux:
Each Network card is shipped with unique MAC address. This MAC address may be needed if you are a Network Admin. If you ever wanted to find the MAC address of the NIC card, then you can run following linux command:
ethtool -P eth0
Check the sample output shown below (I hide the mac address though).
Most common way to find the MAC address of the NIC card is by using the ifconfig –a command. Apart from MAC address, this command will list lots of information about the NIC card. Try running following command to find MAC address:
ifconfig -a
How to find Hardware settings of the NIC in Linux:
If you would like to see hardware settings or features of network card, such as supported link modes, pause frame, duplex, auto-negotiation, speed, port type and link status, then you can run following command:
ethtool eth0
The output of ethtool command is shown below. It gives lots of information about the NIC.
How to find the statistics of the NIC in Linux:
If you would like to find statistics of your NIC card such as how many bytes it received, how many bytes it sent, how many error occurred while transmitting data or while receiving data, was there any medium error, how many unicast packets sent, how many broadcast packets sent and so on. You could find all these information by using following command:
ethtool –s eth0
Here is the output for you. There are tons of information shown over here. This information is very useful while you troubleshoot network card related issues in Linux.
Another method is to use the ifconfig command. This command can give us enough information regarding the NIC statistics. You can find MTU size, MAC address, Sent and receive error by using this command. So go ahead and run the command:
ifconfig
Check the screenshot for more information. From the output you can find that current MTU size is 1500. It means, I have not configured Jumbo Frames on my NIC card. Most NIC card has a maximum frame size of 1500 bytes, so most devices use 1500 as their default MTU but we can increase this value if required. From the below provided screenshot, I could also find Sent (Tx) and Receive (Rx) packet numbers, Number of errors, how many packets are dropped etc.
How to find NIC information using mii-tool in Linux:
We could also use mii-tool to find the NIC information. Personally I do not trust this tool as this utility is old and may not correctly report the speed of 10GBPS NIC cards. However let me show you the usage of mii-tool. Run the following command:.
mii-tool eth0
mii-tool -v eth0
I run both commands in my linux machine and here is the screenshot. This command can also be used to find the Ethernet Link Status.
Today, we have discussed finding Network Card model number, driver, firmware, MAC address, Sent or Receive error. If you know better ways to find Network card information, please do share it with us.
source: https://www.linuxsecrets.com/502-find-nic-model-number-driver-and-firmware-information-in-linux