What driver is my NIC using?

What driver is my NIC using?

Hello people,

in this small blog post I wanted to show you a nice script to see which drivers are used by the Network Interfaces of a Linux machine.

for f in /sys/class/net/*; do
    dev=$(basename $f)
    driver=$(readlink $f/device/driver/module)
    if [ $driver ]; then
        driver=$(basename $driver)
    addr=$(cat $f/address)
    operstate=$(cat $f/operstate)
    printf "%10s [%s]: %10s (%s)\n" "$dev" "$addr" "$driver" "$operstate"

I find this very useful when you need to find out if your interface is running at 10gb or only 1gb. The output looks like this:

      eno1 [2c:60:0c:da:7b:fc]:        igb (up)
  eno1.361 [2c:60:0c:da:7b:fc]:            (up)
  eno1.362 [2c:60:0c:da:7b:fc]:            (up)
  ens255f0 [2c:60:0c:f1:e6:5b]:      ixgbe (up)

So you can see that ens255f0 is a 10gb interface and en1 is only 1 gb.

This script has not been written by me but by an Stackexchange user Buy Amsati , all credits goes to him. For reference here’s the link to the Stackexchange question.



Comments are closed.