centos7-如何手动安装网卡驱动文件
網卡驅動的安裝
準備工作
- 查找網卡的型號
??查看網卡的型號有兩種途徑,一個是直接查看物理網卡硬件上面的廠商標識,此種方式一般需要對桌面機或者服務器進行拆機操作才能查看;另一個是從計算機廠商網站上查看對應型號的硬件列表,以此來確定物理網卡的確切型號.
??還有一種方式,使用 lspci(列出連接到 PCI 總線上的所有設備) 指令進行篩選.
- 查找系統文件(/lib)中是否包含支持的驅動文件
??/lib/modules/release/kernel/drivers目錄中查找所支持的所有驅動程序,其中的release是 unix 的版本型號,使用uname -a進行核對.該目錄下的/net目錄存儲的是支持的所有網絡設備列表;其內的/ethernet目錄存儲的是支持的以太網卡設備.
??總言之,/drivers目錄里的驅動文件,羅列了通用的支持列表,若是自己的設備沒有對應的文件,就需要去手動下載驅動文件了.
- 查找測試虛機中是否包含對應的驅動文件
利用網絡進行查看對比 :
??(1)在搜索引擎中輸入自己的網卡廠商和型號 Intel Corporation 82545EM Gigabit Ethernet Controller,進入其官網的下載頁面,下載對應 OS 的驅動文件;注意篩選關鍵字drivers和linux*,然后選擇穩定的版本進行下載.
??(2)測試虛機下載的驅動名稱是 : e1000-8.0.30.tar.gz ;進行對比/intel中的 e1000 目錄里的驅動文件,可確定測試虛機的系統文件中有支持的網卡驅動文件.
- 查找是否加載了該網卡驅動模塊
??參考上一步的操作,確定了驅動文件的名稱是e1000,然后就可以使用lsmod指令查看內核是否已經加載了該模塊.
??輸出內容的第一列表示網卡的名稱,第二列表示網卡的大小,第三列表示網卡的調用數;第四列表示調用驅動的程序.
- 如何操作驅動模塊文件(modprobe)
modprobe : 智能的向 unix 的內核加載或刪除指定的模塊.modprobe 可以加載單個模塊,也可以加載一組依賴關系的模塊組.主要是借助depmod指令產生的依賴關系,來決定加載哪個模塊;若是在加載的過程中發生錯誤,modprobe 會卸載出錯的整組模塊.
| a | 加載一組匹配的模塊 |
| r | 刪除指定的模塊,若為指定模塊,則會設置成自動清除的模式. |
| n | 僅顯示要執行的操作,而不實際執行 |
| v | 執行時,顯示詳細的執行信息 |
以vfat文件擴展系統模塊為例,進行測試.
輸出執行信息,但不實際操作 :
加載一組指定的模塊 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-如何手动安装网卡驱动文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 20V45-ASEMI低压降贴片肖特基二
- 下一篇: 生成学习全景:从基础理论到GANs技术实