日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos7-如何手动安装网卡驱动文件

發布時間:2024/1/18 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7-如何手动安装网卡驱动文件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

網卡驅動的安裝

準備工作

  • 查找網卡的型號

??查看網卡的型號有兩種途徑,一個是直接查看物理網卡硬件上面的廠商標識,此種方式一般需要對桌面機或者服務器進行拆機操作才能查看;另一個是從計算機廠商網站上查看對應型號的硬件列表,以此來確定物理網卡的確切型號.
??還有一種方式,使用 lspci(列出連接到 PCI 總線上的所有設備) 指令進行篩選.

[root@centos7 ~]# [root@centos7 ~]# lspci | grep -i ethernet 02:00.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) [root@centos7 ~]#
  • 查找系統文件(/lib)中是否包含支持的驅動文件

??/lib/modules/release/kernel/drivers目錄中查找所支持的所有驅動程序,其中的release是 unix 的版本型號,使用uname -a進行核對.該目錄下的/net目錄存儲的是支持的所有網絡設備列表;其內的/ethernet目錄存儲的是支持的以太網卡設備.
??總言之,/drivers目錄里的驅動文件,羅列了通用的支持列表,若是自己的設備沒有對應的文件,就需要去手動下載驅動文件了.

[root@centos7 ~]# [root@centos7 ~]# uname -a Linux centos7 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@centos7 ~]# ls /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/drivers/ acpi bcma char dca firmware hv infiniband leds message mtd nvme pinctrl pps scsi thermal uwb virtio ata block cpufreq dma gpio hwmon input md mfd net parport platform ptp ssb tty vfio watchdog auxdisplay bluetooth crypto edac gpu i2c iommu media misc ntb pci power pwm staging uio vhost xen base cdrom dax firewire hid idle isdn memstick mmc nvdimm pcmcia powercap rtc target usb video [root@centos7 ~]#
  • 查找測試虛機中是否包含對應的驅動文件
[root@centos7 ethernet]# [root@centos7 ethernet]# pwd /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/drivers/net/ethernet [root@centos7 ethernet]# ls amazon aquantia broadcom cadence cavium cisco dnet.ko.xz ethoc.ko.xz intel marvell myricom oki-semi realtek sfc ti amd atheros brocade calxeda chelsio dec emulex icplus jme.ko.xz mellanox netronome qlogic rocker smsc [root@centos7 ethernet]# lspci | grep -i ethernet 02:00.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) [root@centos7 ethernet]# ls intel/ e1000 e1000e fm10k i40e i40evf igb igbvf ixgbe ixgbevf [root@centos7 ethernet]#

利用網絡進行查看對比 :
??(1)在搜索引擎中輸入自己的網卡廠商和型號 Intel Corporation 82545EM Gigabit Ethernet Controller,進入其官網的下載頁面,下載對應 OS 的驅動文件;注意篩選關鍵字drivers和linux*,然后選擇穩定的版本進行下載.
??(2)測試虛機下載的驅動名稱是 : e1000-8.0.30.tar.gz ;進行對比/intel中的 e1000 目錄里的驅動文件,可確定測試虛機的系統文件中有支持的網卡驅動文件.

  • 查找是否加載了該網卡驅動模塊

??參考上一步的操作,確定了驅動文件的名稱是e1000,然后就可以使用lsmod指令查看內核是否已經加載了該模塊.
??輸出內容的第一列表示網卡的名稱,第二列表示網卡的大小,第三列表示網卡的調用數;第四列表示調用驅動的程序.

[root@centos7 ~]# [root@centos7 ~]# lsmod | grep e1000 e1000 137574 0 [root@centos7 ~]#
  • 如何操作驅動模塊文件(modprobe)

modprobe : 智能的向 unix 的內核加載或刪除指定的模塊.modprobe 可以加載單個模塊,也可以加載一組依賴關系的模塊組.主要是借助depmod指令產生的依賴關系,來決定加載哪個模塊;若是在加載的過程中發生錯誤,modprobe 會卸載出錯的整組模塊.

modprobe選項效用
a加載一組匹配的模塊
r刪除指定的模塊,若為指定模塊,則會設置成自動清除的模式.
n僅顯示要執行的操作,而不實際執行
v執行時,顯示詳細的執行信息

以vfat文件擴展系統模塊為例,進行測試.
輸出執行信息,但不實際操作 :

[root@centos7 ~]# [root@centos7 ~]# modprobe -nv vfat insmod /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/fs/fat/fat.ko.xz insmod /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/fs/fat/vfat.ko.xz [root@centos7 ~]#

加載一組指定的模塊 vfat

[root@centos7 ~]# [root@centos7 ~]# modprobe -av vfat insmod /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/fs/fat/fat.ko.xz insmod /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/fs/fat/vfat.ko.xz [root@centos7 ~]#

查看是否加載成功 vfat

[root@centos7 ~]# [root@centos7 ~]# lsmod | grep vfat vfat 17461 0 fat 65950 1 vfat [root@centos7 ~]#

刪除指定的模塊 vfat

[root@centos7 ~]# [root@centos7 ~]# modprobe -rv vfat rmmod vfat rmmod fat [root@centos7 ~]# lsmod | grep vfat [root@centos7 ~]#

手動安裝網卡驅動(源碼包的方式)

以下載的e1000源碼包為例,直接查看安裝文檔即可.

[root@centos7 ~]# [root@centos7 ~]# ll | grep e100 drwxr-xr-x 3 root root 110 Jan 13 2011 e1000-8.0.30 -rw-r--r-- 1 root root 215778 Mar 21 11:07 e1000-8.0.30.tar.gz [root@centos7 ~]# cat -n e1000-8.0.30/README | head -146 | tail -519697 1. Move the base driver tar file to the directory of your choice. For98 example, use /home/username/e1000 or /usr/local/src/e1000.99100 2. Untar/unzip archive:101102 tar zxf e1000-x.x.x.tar.gz103104 3. Change to the driver src directory:105106 cd e1000-x.x.x/src/107108 4. Compile the driver module:109110 make install111112 The binary will be installed as:113114 /lib/modules/<KERNEL VERSION>/kernel/drivers/net/e1000/e1000.[k]o115116 The install locations listed above are the default locations. They117 might not be correct for certain Linux distributions.118119 5. Load the module using either the insmod or modprobe command:120121 modprobe e1000122123 insmod e1000124125 Note that for 2.6 kernels the insmod command can be used if the full126 path to the driver module is specified. For example:127128 insmod /lib/modules/<KERNEL VERSION>/kernel/drivers/net/e1000/e1000.ko129130 With 2.6 based kernels also make sure that older e1000 drivers are131 removed from the kernel, before loading the new module:132133 rmmod e1000; modprobe e1000134135136 6. Assign an IP address to the interface by entering the following, where137 x is the interface number:138139 ifconfig ethx <IP_address>140141 7. Verify that the interface works. Enter the following, where <IP_address>142 is the IP address for another machine on the same subnet as the143 interface that is being tested:144145 ping <IP_address>146 [root@centos7 ~]#

另推薦一個靜態網卡的配置文件,此文件在 centos6.x 和 centos7.x 中都可適用.注意網卡名稱和 mac 地址的更改,其他的路由參數依照實際情況的配置.

[root@centos7 ~]# [root@centos7 ~]# cat -n /etc/sysconfig/network-scripts/ifcfg-ens321 #/etc/sysconfig/network-scripts/ifcfg-ens322 ONBOOT=yes3 IPADDR=192.168.44.1334 NETMASK=255.255.255.05 GATEWAY=192.168.44.26 BROADCAST=192.168.44.2557 NETWORK=192.168.44.08 HWADDR=00:0C:29:D3:24:1B9 DNS1=180.76.76.7610 DNS2=114.114.114.11411 NAME=ens32 [root@centos7 ~]#

總結

以上是生活随笔為你收集整理的centos7-如何手动安装网卡驱动文件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。