How do I find what kernel module is behind a network interface?

1,296

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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

lsusb -t
Share:
1,296
bharal
Author by

bharal

Updated on September 18, 2022

Comments

  • bharal
    bharal over 1 year

    At some stage in a concordion test I have, I set a value to some random number.

    This value is passed along, and later on , I have some output. The output is "checked" using the concordion "table" setup, where i compare an output value to what I expect it to be.

    The problem I have is that I would like to check against the random number mentioned above. When I get the random number, I can set it to something Concordion can store -

    <span c:set="#prefixValue">Bob</span>
    

    Well, you get the idea - I replace "Bob" with a getter for my value.

    But when I try to use it:

    <table c:execute="#actual = getValue(#report, #xpath)">
        <tr>
            <th>Field name</th>
            <th c:assertEquals="#actual">Value</th>
            <th c:set="#xpath">Xpath</th>
        </tr>
        <tr>
            <td>UnrelatedValue</td>
            <td>SomeDeterminateValue</td>
            <td>theXpathForThisToCompareTo</td>
        </tr>
        <tr>
            <td>prefix</td>
            <td><span c:echo="#prefixValue" /></td>
            <td>differentXpathForThisToCompareTo</td>
        </tr>
    

    The whole shebang grinds to a halt, complaining that

    " Commands must be placed on elements when using 'execute' or 'verifyRows' commands on a <table>. "

    How can I use a pre-determined value in a table in Concordion?

  • bharal
    bharal over 10 years
    interesting idea, in the end i just rolled my own comparator. Still don't understand why i cannot have a value i've saved elsewhere (out of the box, i mean)- seems pretty weak sauce to me.
  • ᴇʟᴇvᴀтᴇ
    ᴇʟᴇvᴀтᴇ over 10 years
    It's against Concordion's general philosophy of "don't do anything fancy in the specs". The specs are intended to be like static documentation, not JSPs.
  • pevik
    pevik almost 7 years
    How to detect virtual drivers (e.g. veth)? It's possible with ethtool -i IFACE_NAME, but how to find it from sysfs?