centos7-如何手动安装网卡驱动文件
網(wǎng)卡驅(qū)動(dòng)的安裝
準(zhǔn)備工作
- 查找網(wǎng)卡的型號(hào)
??查看網(wǎng)卡的型號(hào)有兩種途徑,一個(gè)是直接查看物理網(wǎng)卡硬件上面的廠商標(biāo)識(shí),此種方式一般需要對(duì)桌面機(jī)或者服務(wù)器進(jìn)行拆機(jī)操作才能查看;另一個(gè)是從計(jì)算機(jī)廠商網(wǎng)站上查看對(duì)應(yīng)型號(hào)的硬件列表,以此來確定物理網(wǎng)卡的確切型號(hào).
??還有一種方式,使用 lspci(列出連接到 PCI 總線上的所有設(shè)備) 指令進(jìn)行篩選.
- 查找系統(tǒng)文件(/lib)中是否包含支持的驅(qū)動(dòng)文件
??/lib/modules/release/kernel/drivers目錄中查找所支持的所有驅(qū)動(dòng)程序,其中的release是 unix 的版本型號(hào),使用uname -a進(jìn)行核對(duì).該目錄下的/net目錄存儲(chǔ)的是支持的所有網(wǎng)絡(luò)設(shè)備列表;其內(nèi)的/ethernet目錄存儲(chǔ)的是支持的以太網(wǎng)卡設(shè)備.
??總言之,/drivers目錄里的驅(qū)動(dòng)文件,羅列了通用的支持列表,若是自己的設(shè)備沒有對(duì)應(yīng)的文件,就需要去手動(dòng)下載驅(qū)動(dòng)文件了.
- 查找測試虛機(jī)中是否包含對(duì)應(yīng)的驅(qū)動(dòng)文件
利用網(wǎng)絡(luò)進(jìn)行查看對(duì)比 :
??(1)在搜索引擎中輸入自己的網(wǎng)卡廠商和型號(hào) Intel Corporation 82545EM Gigabit Ethernet Controller,進(jìn)入其官網(wǎng)的下載頁面,下載對(duì)應(yīng) OS 的驅(qū)動(dòng)文件;注意篩選關(guān)鍵字drivers和linux*,然后選擇穩(wěn)定的版本進(jìn)行下載.
??(2)測試虛機(jī)下載的驅(qū)動(dòng)名稱是 : e1000-8.0.30.tar.gz ;進(jìn)行對(duì)比/intel中的 e1000 目錄里的驅(qū)動(dòng)文件,可確定測試虛機(jī)的系統(tǒng)文件中有支持的網(wǎng)卡驅(qū)動(dòng)文件.
- 查找是否加載了該網(wǎng)卡驅(qū)動(dòng)模塊
??參考上一步的操作,確定了驅(qū)動(dòng)文件的名稱是e1000,然后就可以使用lsmod指令查看內(nèi)核是否已經(jīng)加載了該模塊.
??輸出內(nèi)容的第一列表示網(wǎng)卡的名稱,第二列表示網(wǎng)卡的大小,第三列表示網(wǎng)卡的調(diào)用數(shù);第四列表示調(diào)用驅(qū)動(dòng)的程序.
- 如何操作驅(qū)動(dòng)模塊文件(modprobe)
modprobe : 智能的向 unix 的內(nèi)核加載或刪除指定的模塊.modprobe 可以加載單個(gè)模塊,也可以加載一組依賴關(guān)系的模塊組.主要是借助depmod指令產(chǎn)生的依賴關(guān)系,來決定加載哪個(gè)模塊;若是在加載的過程中發(fā)生錯(cuò)誤,modprobe 會(huì)卸載出錯(cuò)的整組模塊.
| a | 加載一組匹配的模塊 |
| r | 刪除指定的模塊,若為指定模塊,則會(huì)設(shè)置成自動(dòng)清除的模式. |
| n | 僅顯示要執(zhí)行的操作,而不實(shí)際執(zhí)行 |
| v | 執(zhí)行時(shí),顯示詳細(xì)的執(zhí)行信息 |
以vfat文件擴(kuò)展系統(tǒng)模塊為例,進(jìn)行測試.
輸出執(zhí)行信息,但不實(shí)際操作 :
加載一組指定的模塊 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 ~]#手動(dòng)安裝網(wǎng)卡驅(qū)動(dòng)(源碼包的方式)
以下載的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 ~]#另推薦一個(gè)靜態(tài)網(wǎng)卡的配置文件,此文件在 centos6.x 和 centos7.x 中都可適用.注意網(wǎng)卡名稱和 mac 地址的更改,其他的路由參數(shù)依照實(shí)際情況的配置.
[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 ~]#總結(jié)
以上是生活随笔為你收集整理的centos7-如何手动安装网卡驱动文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 20V45-ASEMI低压降贴片肖特基二
- 下一篇: 备份utu信息丢失_关于数据丢失和家庭备