1. 查看設備信息,確定自己網卡型號
lspci -nn | grep -i net
這里lspci是列出pci總線上連接的所有設備,以這個作為輸入,通過管道進行過濾,grep獲取網卡信息
這里是我的網卡信息:
00:07.0 Bridge [0680]: NVIDIA Corporation MCP61 Ethernet [10de:03ef] (rev a2)
2. 下載驅動文件,根據其中的
10de:03ef
可以到這個鏈接([2] http://elrepo.org/tiki/DeviceIDs)去check應該下什么驅動模塊
我的系統內核版本,我到這個鏈接(http://elrepo.org/linux/elrepo/el7/x86_64/RPMS/kmod-forcedeth-0.64-1.el7.elrepo.x86_64.rpm)下載了驅動文件kmod-forcedeth-0.64-1.el7.elrepo.x86_64.rpm,拷貝到這個電腦上。
如何查看內核版本?(我的centos7 2009)
uname -r
3.10.0-123.el7.x86_64
3. 安裝rpm文件
su rpm -ivh kmod-forcedeth-0.64-1.el7.elrepo.x86_64.rpm
安裝好后會顯示軟件包已經安裝。
4. 啟動服務
但是安裝完后驅動并沒有啟動,可以用lsmod看下有哪些模塊在運行
lsmod | grep forcedeth
這里我用grep看forcedeth
結果輸出為空
激活驅動
modprobe forcedeth
這時候就可以看到forcedeth了
lsmod | grep forcedeth
forcedeth 71574 0
添加網絡接口,生成配置文件 nmcli connection add con-name <網絡接口名稱> type <接口類型> ifname <網卡名稱> nmcli connection add con-name ens0 type ethernet ifname ens0
借鑒https://blog.csdn.net/justcyf/article/details/52453868