Monday, May 2, 2016

RHEL - Find the driver for attached Ethernet Card

How to find the device driver used for a device?

For eg, lets find the driver for Ethernet card

$ sudo lspci
# lspci | grep -i net

# lspci | grep -i net
00:19.0 Ethernet controller: Intel Corporation 82567LM-3 Gigabit Network Connection (rev 02)

# find /sys | grep drivers.*00:19.0

So, ether netcard is e1000

Find PCI vendor and device codes

# lspci -n | grep '00:19.0'
00:19.0 0200: 8086:10de (rev 02)

8086:10de stands for vendor:device ID

Now, go to the site
and search for the vendor:dev id, you will find,

pci 8086:10DE kmod-e1000e

Now, go to

Find the right version such as el5/el6/el7

go the the specified version location and download the RPM

# wget

# rpm -ivh kmod-e1000e-3.3.3-1.el7.elrepo.x86_64.rpm

Once you done, reboot the machine.

# lspci -nk # show you attached drivers

$ cat
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"

$ sh
   enp0s25 [00:23:ae:b0:32:0c]:     e1000e (up)
        lo [00:00:00:00:00:00]:            (unknown)
    virbr0 [52:54:00:a0:6d:79]:            (down)
virbr0-nic [52:54:00:a0:6d:79]:            (down)

No comments:

Post a Comment