我的機器是DELL 14R INSPRION 7420 筆記本。試了好多方法都不行,比如這個教程:
1. sudo ifconfig -a //查看所有網卡現狀,看eth0是否存在,在結果列表應該找不到eth0網卡的,除了lo之外,正常應該還有一個ethX 2. vim /etc/network/interfaces //修改內容如下 auto ethX iface ethX inet dhcp //或 www.2cto.com auto ethX iface ethX inet static address 192.168.0.101 netmask 255.255.255.0 gateway 192.168.0.1 3. sudo /etc/init.d/networking restart //重新啟動網卡,問題可解決。
因為我的網卡根本沒有驅動進來,所以這些都是胡鬧。
正確做法:
先查看一下網卡信息:
wy@wy-Inspiron-7420:~$ lspci -k|grep -i -A2 net 02:00.0 Network controller: Intel Corporation Centrino Wireless-N 2230 (rev c4) Subsystem: Intel Corporation Centrino Wireless-N 2230 BGN Kernel driver in use: iwlwifi -- 03:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 10) Subsystem: Dell Device 055f Kernel driver in use: alx
從上可見我的有線網卡是AR8161 Gigabit Ethernet。然后去找這個型號的網卡驅動並安裝(如果是其它網卡的,在百度谷歌里去搜它的驅動)。
sudo -i #進root權限 wget http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-03-12-p.tar.bz2 tar xvf compat-wireless-2012-03-12-p.tar.bz2 cd compat-wireless-2012-03-12-p ./scripts/driver-select alx make make install ./scripts/alx-enable atl1c ./scripts/alx-enable alx modprobe alx
ok,eth0出來啦。