【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

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

相关推荐
menge23331 分钟前
VLAN:虚拟局域网
网络·智能路由器
ZachOn1y26 分钟前
计算机网络:计算机网络概述 —— 初识计算机网络
网络·计算机网络·知识点汇总·考研必备
三金121381 小时前
SpringIoC容器的初识
网络·网络协议·rpc
韩楚风1 小时前
【linux 多进程并发】linux进程状态与生命周期各阶段转换,进程状态查看分析,助力高性能优化
linux·服务器·性能优化·架构·gnu
陈苏同学1 小时前
4. 将pycharm本地项目同步到(Linux)服务器上——深度学习·科研实践·从0到1
linux·服务器·ide·人工智能·python·深度学习·pycharm
Ambition_LAO1 小时前
解决:进入 WSL(Windows Subsystem for Linux)以及将 PyCharm 2024 连接到 WSL
linux·pycharm
Pythonliu71 小时前
茴香豆 + Qwen-7B-Chat-Int8
linux·运维·服务器
你疯了抱抱我1 小时前
【RockyLinux 9.4】安装 NVIDIA 驱动,改变分辨率,避坑版本。(CentOS 系列也能用)
linux·运维·centos
追风赶月、1 小时前
【Linux】进程地址空间(初步了解)
linux
栎栎学编程1 小时前
Linux中环境变量
linux