標籤:centos迷你安裝後ar8151網卡驅動安裝 linux安裝ar8151網卡驅動
最近拿來一台PC,12年的時候安裝的CentOS6.2(x64),那個時候使用的是外置網卡,迷你安裝系統時,主板內建網卡沒有顯示出來也就沒注意,但是最近需要用到雙網卡,就鬱悶了。於是發生了下面一系列問題。
1、lspci命令沒有
遇到問題:
在迷你安裝的centos6.X系統中,使用lspci命令查看硬體資訊,提示找不到命令:command not found。
[[email protected] netperf-2.6.0]# lspci
-bash: lspci: command not found
解決辦法安裝:pciutils
# yum install pciutils
2、查看系統有哪些網卡
[[email protected] netperf-2.6.0]# lspci | grep Ethernet
02:00.0 Ethernet controller: Atheros Communications Inc. AR8151 v2.0 Gigabit Ethernet (rev c0)
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
其實我這個系統還有一個無線網卡,USB的
3、查看網卡驅動
這裡使用ifconfig -a只能看到eth0和lo0,且eth0的驅動資訊如下,說明AR8151驅動沒有安裝
[[email protected] netperf-2.6.0]# ethtool -i eth0
driver: r8169
version: 2.3LK-NAPI
firmware-version:
bus-info: 0000:04:00.0
4、CentOS下安裝AR8151網卡驅動
遇到問題:
在網上搜尋一下,說要下載驅動包,然後make等。
下載AR81Family-Linux-v1.0.1.9.tar.gz(由於此方法其實沒有卵用,所以就不提供了)
但是並不能像網上有的說的那樣使在src中make、make install(查看解決檔案中readme),結果報“Makefile:61: *** Linux kernel source not found. stop”這樣的錯誤;網上搜了以後開始是以為有些kernel包沒有安裝,安裝kernel、kernel-devel、kernel-devel、kernel-headers的rpm包後還是報同樣的錯誤。
解決辦法:
發現網卡不相容最後終於在網上找到瞭解決的方法:
(1)開啟/sys/bus/pci/drivers路徑,開始這裡是沒有一個叫做atl1c的目錄的(如果有也沒關係)。
(2)modprobe atl1c然後再看/sys/bus/pci/drivers下,是否出現了atl1c目錄?
(3)echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id(顯示許可權不夠)
備忘:如果你是root使用者,就不會出現提示許可權不夠的問題了,同時也就不需要進行4、5、6步驟了。
(4)chmod 777 /sys/bus/pci/drivers/atl1c/new_id
(5)echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id
(6)chmod 400 /sys/bus/pci/drivers/atl1c/new_id
執行上面步驟後,需要重啟網路
#service network restart
但問題又來了,我不可能每次都開機後執行上面的步驟啊,太麻煩了,而且如果是別人操作,如果不知道這個情況就更慘了。
那就寫個開機指令碼吧,很簡單,沒啥複雜。
[[email protected] ~]# cd /etc/init.d/ //進入到開機啟動指令碼目錄中
[[email protected] init.d]# vi atl.sh
#!/bin/sh
# this script start AR8151 --by [email protected]
#
# chkconfig: - 90 25
modprobe atl1c
echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id
service network restart
~
"atl.sh" [New] 11L, 183C written
[[email protected] init.d]# chmod +x atl.sh //給予執行的許可權
[[email protected] init.d]# ./atl.sh
正在關閉介面 eth0: 裝置狀態:3 (中斷連線)
[確定]
關閉環回介面: [確定]
彈出環回介面: [確定]
彈出介面 eth0: 活躍串連狀態:啟用的
活躍串連路徑:/org/freedesktop/NetworkManager/ActiveConnection/1
[確定]
[[email protected] init.d]# chkconfig atl.sh on //加入開機啟動項
PS:本來是想在/etc/rc.local中添加命令來實現,不過發現重啟系統後,並沒有將網卡驅動加上,所以還是寫了個簡單的指令碼。
參考文檔:http://www.idcnote.com/article.asp?id=85
本文出自 “飛翔的豬” 部落格,請務必保留此出處http://thinkpig007.blog.51cto.com/971471/1671974
CentOS迷你安裝後AR8151網卡驅動未安裝解決辦法