【Linux】如何查看网卡驱动

如何查看网卡驱动?

要查看机器的网卡驱动程序,您可以使用以下几种方法。这些方法可以帮助您查找并识别当前正在使用的网卡驱动程序。

方法1:使用 ethtool

ethtool 可以显示网络接口的详细信息,包括驱动程序名称。

sh 复制代码
sudo ethtool -i <interface_name>

例如:

sh 复制代码
sudo ethtool -i eth0

输出示例:

复制代码
driver: e1000e
version: 3.2.6-k
firmware-version: 0.13-3
expansion-rom-version: 
bus-info: 0000:00:19.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

方法2:使用 lshw

lshw 工具可以列出所有硬件设备,包括网络设备及其驱动程序。

sh 复制代码
sudo lshw -class network

输出示例:

复制代码
  *-network
       description: Ethernet interface
       product: Ethernet Connection I217-LM
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: eth0
       version: 04
       serial: 00:1a:2b:3c:4d:5e
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.13-3 ip=192.168.1.2 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:20 memory:f7e00000-f7e1ffff memory:f7e3d000-f7e3dfff ioport:f080(size=32)

configuration 部分,可以看到 driverdriverversion 字段。

方法3:使用 lspci

lspci 命令可以列出 PCI 设备,通过该命令结合 grep 可以找到网卡信息。

sh 复制代码
lspci -v | grep -i ethernet

输出示例:

复制代码
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-LM (rev 04)
        Subsystem: Lenovo ThinkPad T440p
        Flags: bus master, fast devsel, latency 0, IRQ 45
        Memory at f7e00000 (32-bit, non-prefetchable) [size=128K]
        Memory at f7e3d000 (32-bit, non-prefetchable) [size=4K]
        I/O ports at f080 [size=32]
        Capabilities: [c8] Power Management version 2
        Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [e0] PCI Advanced Features
        Kernel driver in use: e1000e
        Kernel modules: e1000e

Kernel driver in use 字段中显示了当前使用的驱动程序。

方法4:使用 /sys/class/net

在 Linux 系统中,您还可以通过读取 /sys/class/net 文件系统中的文件来查看网卡驱动程序的信息。

sh 复制代码
cat /sys/class/net/<interface_name>/device/driver/module

例如:

sh 复制代码
cat /sys/class/net/eth0/device/driver/module

输出会显示驱动程序模块的路径,例如:

复制代码
/sys/module/e1000e

总结来说,这几种方法都可以用来查看系统当前网卡使用的驱动程序。选择最适合您的方法来获取所需的信息。

相关推荐
摘星|28 分钟前
架设一台NFS服务器,并按照以下要求配置
linux·运维·服务器
做运维的阿瑞37 分钟前
Linux环境变量持久化完全指南
linux·运维·服务器
天才奇男子1 小时前
从零开始搭建Linux Web服务器
linux·服务器·前端
xxtzaaa1 小时前
游戏被IP限制多开,如何在同一网络下用不同IP多开游戏?
网络·tcp/ip·游戏
DY009J1 小时前
如何在Ubuntu虚拟机中设置Samba共享,并在Windows宿主机中挂载为网络驱动器
网络·windows·ubuntu
Mr_Dwj1 小时前
【运维】GNU/Linux 入门笔记
linux·运维·gnu
Elias不吃糖2 小时前
NebulaChat项目构建笔记
linux·c++·笔记·多线程
SHIPKING3932 小时前
【Docker安装】Windows10专业版安装教程
运维·docker·容器
编程的一拳超人2 小时前
Docker核心概念、常用命令与实战指南
运维·docker·容器
编程的一拳超人2 小时前
Docker 核心命令速查表(精细分类版)
运维·docker·容器