服务器如何查看网卡驱动和更换网卡驱动

2024年 1月 18日 42.2k 0

一.查看网卡驱动

要查看系统中网卡的驱动程序,您可以使用一些特定于您的操作系统的命令。

以下是一些示例:

Linux:

使用 lspci 命令来列出 PCI 设备,然后查找网卡的相关信息:

lspci | grep Ethernet
bin# lspci | grep Ethernet
0002:02:00.0 Ethernet controller: Cavium, Inc. Octeon Tx2 RVU Physical Function (rev 54)
0002:03:00.0 Ethernet controller: Cavium, Inc. Octeon Tx2 RVU Physical Function (rev 54)
0002:04:00.0 Ethernet controller: Cavium, Inc. Octeon Tx2 RVU Physical Function (rev 54)
0002:05:00.0 Ethernet controller: Cavium, Inc. Octeon Tx2 RVU Physical Function (rev 54)
0008:01:00.0 Ethernet controller: Marvell Technology Group Ltd. Device 2141

然后,使用 lshw 或 ethtool 命令来获取更详细的信息:

sudo lshw -class network
bin# lshw -class network
  *-network
       description: Network controller
       product: Octeon 10 RPM (MAC)
       vendor: Cavium, Inc.
       physical id: 10
       bus info: pci@0000:01:10.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: pciexpress msix bus_master cap_list
       configuration: driver=Marvell-CGX!RPM latency=0
       resources: irq:0 memory:87e0e0000000-87e0e07fffff memory:87e0e0800000-87e0e0ffffff

或 

sudo ethtool <interface_name>
bin# ethtool eth1
Settings for eth1:
        Supported ports: [  ]
        Supported link modes:   10baseT/Half
                                10000baseSR/Full
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: RS
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 50000Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        MDI-X: Unknown
        Current message level: 0x00000000 (0)

        Link detected: yes

Windows:

在 PowerShell 中,可以使用 Get-NetAdapter 命令来获取网络适配器信息:

Get-NetAdapter

图片[1]-服务器如何查看网卡驱动和更换网卡驱动-不念博客powershell

二.切换网卡驱动程序:

在一般情况下,更改网卡驱动程序可能不是一个简单的任务,因为它涉及到操作系统内核模块(Linux)或设备管理器(Windows)。

这通常需要一些谨慎的操作,并且可能需要重新启动系统。

Linux:

  • 查找当前加载的网卡驱动程序:
  • lsmod | grep <driver_name>
    ~$ lsmod
    Module                  Size  Used by
    vfio_pci               16384  0
    vfio_pci_core          94208  1 vfio_pci
    vfio_iommu_type1       49152  0
    vfio                   61440  3 vfio_pci_core,vfio_iommu_type1,vfio_pci
    iommufd                73728  1 vfio
    irqbypass              16384  1 vfio_pci_core
    nf_tables             348160  0
    libcrc32c              16384  1 nf_tables
    cpuid                  16384  0
    nfnetlink              24576  1 nf_tables
    tls                   147456  0
    binfmt_misc            24576  1
    nls_iso8859_1          16384  1
    intel_rapl_msr         20480  0
    
    ~$ lsmod |grep vfio
    vfio_pci               16384  0
    vfio_pci_core          94208  1 vfio_pci
    vfio_iommu_type1       49152  0
    vfio                   61440  3 vfio_pci_core,vfio_iommu_type1,vfio_pci
    iommufd                73728  1 vfio
    irqbypass              16384  1 vfio_pci_core
  • 卸载当前驱动程序:
  • sudo modprobe -r <driver_name>
    ~$ sudo modprobe -r  vfio-pci
    ~$ lsmod |grep vfio
    vfio_iommu_type1       49152  0
    vfio                   61440  1 vfio_iommu_type1
    iommufd                73728  1 vfio
  • 加载新的驱动程序:
  • sudo modprobe <new_driver_name>
    ~$ sudo modprobe vfio-pci
    ~$ lsmod |grep vfio
    vfio_pci               16384  0
    vfio_pci_core          94208  1 vfio_pci
    irqbypass              16384  1 vfio_pci_core
    vfio_iommu_type1       49152  0
    vfio                   61440  3 vfio_pci_core,vfio_iommu_type1,vfio_pci
    iommufd                73728  1 vfio

    Windows:

  • 在设备管理器中更改驱动程序:
    • 在 Windows 中,右键点击“此电脑”(或“计算机”),选择“管理”。
    • 转到“设备管理器”。
    • 在“网络适配器”下找到您的网卡。
    • 右键点击网卡,选择“更新驱动程序”。

    注意:更改驱动程序可能需要从制造商的网站下载适当的驱动程序,并确保它与您的硬件和操作系统兼容。

    影响:

    更改网卡驱动程序可能导致以下影响:

  • 兼容性问题: 新的驱动程序可能不兼容您的硬件或操作系统,导致网络连接问题。
  • 性能影响: 不同的驱动程序可能对性能产生影响,有时是正面的,有时是负面的。
  • 稳定性问题: 一些驱动程序可能更加稳定,而另一些可能引入稳定性问题。
  • 在进行任何更改之前,请确保备份系统数据,并仔细阅读相关的文档和支持信息。

    最好在测试环境中先尝试更改,以便在生产环境中遇到问题时能够迅速进行修复。

    相关文章

    服务器端口转发,带你了解服务器端口转发
    服务器开放端口,服务器开放端口的步骤
    产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
    如何使用 WinGet 下载 Microsoft Store 应用
    百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
    百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

    发布评论