Skip to content
systemcoding.dev
Kernels

List Network Interfaces and Their Drivers With ip and ethtool -i

Find every network interface on Linux 6.12 and the kernel driver behind it with ip link and ethtool -i, and read the same facts from sysfs for scripts.

6 min read
Summarize in AI
Flat illustration of user space above the system call boundary, the kernel and the hardware, with the Linux, FreeBSD and Rust logos.

When a network problem might be the driver, the first facts you need are which interfaces exist, which driver runs each one, and what firmware is loaded on the card. Two commands answer all three: ip lists the interfaces, and ethtool -i asks an interface's driver to describe itself. This post uses iproute2 6.12 and ethtool 6.11 on Linux 6.12 to read those outputs, decode the interface names, tell physical interfaces from virtual ones, and find the same information in sysfs for scripts. It is the first step before the deeper material in the guide to network device drivers.

The ip tool is documented in its man pages, and the driver information comes from the ethtool interface described in the kernel's ethtool documentation.

List the interfaces

The brief form of ip link prints one line per interface:

Shell
ip -br link
Text
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
enp0s31f6        UP             a4:bb:6d:12:34:56 <BROADCAST,MULTICAST,UP,LOWER_UP>
wlp3s0           DOWN           3c:f0:11:ab:cd:ef <BROADCAST,MULTICAST>
docker0          DOWN           02:42:ac:11:00:01 <NO-CARRIER,BROADCAST,MULTICAST,UP>
veth3f2a1b@if2   UP             7e:8a:11:22:33:44 <BROADCAST,MULTICAST,UP,LOWER_UP>

The first column is the name, the second the operational state, the third the MAC address and the last the flags. LOWER_UP means the link layer is up, so a cable is connected and the other end answers. NO-CARRIER is the cable-unplugged signal. UP in the flags means the interface is administratively enabled, which is a separate fact from the state column.

The names follow a convention that carries information, when the system uses predictable names. enp0s31f6 decodes as: en for Ethernet, p0 for PCI bus 0, s31 for slot (device) 31 and f6 for function 6. You can match that with the address in lspci, which prints 00:1f.6 for the same device. A name starting with wl is a wireless LAN and ww a wireless WAN. Names such as eth0 appear on systems that have turned predictable naming off, and on virtual machines where the platform does not provide a stable path.

The @if2 suffix on veth3f2a1b shows that it is one end of a pair, whose other end is interface index 2 in another network namespace. That is how container networking looks from the host.

Ask the driver

ethtool -i queries the driver bound to an interface:

Shell
ethtool -i enp0s31f6
Text
driver: e1000e
version: 6.12.8
firmware-version: 0.5-4
expansion-rom-version: 
bus-info: 0000:00:1f.6
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

Each line is worth reading.

driver is the kernel module name, which you can pass to modinfo to see its parameters and supported IDs. This is the most useful field, and it is the one to quote in a bug report.

version is the driver version. For in-tree drivers it is usually the kernel release, as here. Some out-of-tree drivers print their own number, which is how you tell that a vendor driver replaced the kernel's.

firmware-version is what the device itself reports: the version of the firmware running on the card. It is what you compare against a vendor's advisory.

bus-info locates the device on its bus. For a PCI card it is the PCI address, the key that links this interface to lspci -s 00:1f.6 -k. For a USB adapter it reads usb-0000:00:14.0-2, and for a platform device on an embedded board it is the device name. A virtual interface has none of this, as the next section shows.

The supports- lines tell you which other ethtool operations will work: statistics with -S, a self-test with -t, the EEPROM with -e, and register dumps with -d.

Virtual interfaces

Not every line in ip link is hardware. ethtool -i tells them apart, because a virtual driver describes itself too:

Shell
ethtool -i veth3f2a1b
ethtool -i docker0
ethtool -i lo
Text
driver: veth
version: 1.0
firmware-version: 
bus-info: 
...
driver: bridge
version: 2.3
firmware-version: N/A
bus-info: N/A
...
Cannot get driver information: Operation not supported

The pair veth and bridge are in-kernel virtual drivers with no bus-info. The loopback interface supports no driver query at all, which is normal. The driver field is the fastest way to tell a physical card (e1000e, igb, ixgbe, r8169, iwlwifi) from a virtual device (veth, bridge, tun, wireguard, macvlan).

For more detail on a virtual interface, ip -d link show prints the type and its settings:

Shell
ip -d link show docker0 | head -n 3
Text
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:42:ac:11:00:01 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65535
    bridge forward_delay 1500 hello_time 200 max_age 2000 ageing_time 30000 stp_state 0 priority 32768 vlan_filtering 0 vlan_protocol 802.1Q bridge_id 8000.2:42:ac:11:0:1 designated_root 8000.2:42:ac:11:0:1 root_port 0 ...

The word after the MAC line, bridge, is the link type. Other types you will see are vlan, bond, vxlan, tun and wireguard.

The same facts from sysfs

Scripts should not parse the output of ip or ethtool. Every interface has a directory under /sys/class/net/, and a physical one links to its device:

Shell
ls /sys/class/net
readlink /sys/class/net/enp0s31f6/device
readlink /sys/class/net/enp0s31f6/device/driver
cat /sys/class/net/enp0s31f6/operstate
cat /sys/class/net/enp0s31f6/address
Text
docker0  enp0s31f6  lo  veth3f2a1b  wlp3s0
../../../0000:00:1f.6
../../../../bus/pci/drivers/e1000e
up
a4:bb:6d:12:34:56

The device symlink exists only for interfaces backed by a bus device, so its absence is itself the test for a virtual interface. The driver link under it names the driver, equal to what ethtool -i prints, and the PCI address in the first link is the bus-info. The files operstate, address, mtu and speed give the rest as plain text, one value per file.

A short loop lists every physical interface with its driver, and works on a system that has no ethtool installed:

Shell
for n in /sys/class/net/*; do
    if [ -e "$n/device/driver" ]; then
        echo "$(basename "$n") $(basename "$(readlink "$n/device/driver")")"
    fi
done
Text
enp0s31f6 e1000e
wlp3s0 iwlwifi

What to do with the answer

With the driver name in hand, the next questions have direct commands. modinfo e1000e lists the module's parameters, supported device IDs and firmware files. ethtool -S enp0s31f6 prints the driver's own counters, where the useful ones are the error and drop counts that ip -s link does not break down. ethtool enp0s31f6 shows the negotiated speed and duplex, and dmesg | grep -i e1000e shows what the driver logged at probe, including firmware loading and link state changes.

If an interface you expect is missing from ip link, check the layer below it. lspci -k shows whether the card has a driver, as in the post on PCI driver lookup, and dmesg shows why a driver failed to bind, often a missing firmware file.

Reading the interface name before you trust it

A name can mislead. The kernel's own name for a new interface is a prefix and a number, and udev renames it at boot using the rules in systemd.net-naming-scheme. The result depends on which information the firmware provides: an on-board device with a firmware index gets a name like eno1, a PCI slot with a hotplug number gets ens1, and everything else falls back to the bus path form enp0s31f6. A card moved to a different slot therefore changes name, and a firewall rule or a service file that names the old interface breaks without any visible error. When a configuration refers to an interface by name, check the name against ethtool -i and the MAC address, and prefer matching by MAC in network configuration files, since the address follows the card.

Also inNetworking
Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.