24

How do I find out what kernel module is used for any given network interface?

Matt Joiner
  • 1,607
  • 4
  • 14
  • 23

4 Answers4

25

On the command line run

sudo lshw -C network 

For every network interface you'll get a section starting with *-network. Every section hast a logical name: line that contains the interface name and a configuration: line that contain the driver and some other information.

Florian Diesch
  • 86,013
  • 17
  • 224
  • 214
20

You can query sysfs to tell you this information. To tell which driver a network interface is using:

ls -l /sys/class/net/<devname>/device/driver

... where <devname> is something like eth0. This driver directory will be a symlink to the driver node in sysfs.

To get the name of the module that provides that driver:

ls -l /sys/class/net/<devname>/device/driver/module

... and this module directory will be a symlink to the module node in sysfs.

Jeremy Kerr
  • 26,769
  • 4
  • 48
  • 62
  • How to detect virtual drivers (e.g. `veth`)? It's possible with `ethtool -i IFACE_NAME`, but how to find it from sysfs? – pevik Jul 20 '17 at 21:18
9

IMHO for scripts the best is to use sysfs info (as Jeremy Kerr shows), but for more info:

ethtool -i IFACE_NAME

E.g.:

$ ethtool -i eth0
driver: 8139cp
version: 1.3
firmware-version: 
bus-info: 0000:00:07.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
pevik
  • 443
  • 5
  • 10
3

For USB devices you can use the lsusb command e.g.:

lsusb -t
Pierz
  • 2,905
  • 1
  • 24
  • 14