歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 在Linux下如何確定網卡所使用驅動程序

在Linux下如何確定網卡所使用驅動程序

日期:2017/2/28 16:19:51   编辑:Linux教程

有些時候你可能想知道某個Linux系統的網卡正在使用什麼驅動程序,下面簡單介紹下如何解決這個問題。

1. 無論是集成網卡還是獨立的網卡,都必須通過某種方式連接到PCI總線上,這樣的話,必定有有一個代號,

這個代號可以通過下面的命令獲得

# lspci | grep Ethernet

02:00.0 Ethernet controller: Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper) (rev 01)

最前面的 “02:00.0” 就是設備在PCI總線上的代號,該代號在整個系統中是唯一的.

2. 得到網卡的PCI代號之後,我們就可以在sysfs中查找它的驅動了,命令如下

# cd /sys/bus/pci/drivers

# find | grep '02:00.0'

./e1000e/0000:02:00.0

3. 通過上面的命令,我們可以發現,設備在“e1000e”文件夾下,也就是說,網卡的驅動就是e1000e

4. 小結下,在Linux系統上,找出網卡正在使用的驅動的命令如下

# code=$(lspci | grep Ethernet | head -1 | awk '{print $1}')

# find /sys/bus/pci/drivers/ | grep $code | awk -F/ '{print $6}'

# find /sys/bus/pci/drivers/ | grep $(lspci | grep Ethernet | head -1 | awk '{print $1}') | awk -F/ '{print $6}'

完 :-)

Copyright © Linux教程網 All Rights Reserved