般来说,版本2.6以上的内核都已包含
网卡驱动,所以无法上网时,先确认是否已经安装了
网卡驱动.
1. 确认是否安装
网卡驱动。
方法一:
打开系统->系统管理->网络工具
可以看到网络设备,一般包含三个:回环节口(lo),
以太网卡(eth0),无线网卡(wlan0)。
有对应网络设备即已安装对应的驱动。
方法二:
终端输入:
ifconfig
获得如下信息:
eth0
Link encap:以太网 硬件地址 00:26:9e:f6:05:99
inet 地址:219.223.195.56 广播:219.223.195.127 掩码:255.255.255.128
inet6 地址: 2001:250:3c02:236:226:9eff:fef6:599/64 Scope:Global
inet6 地址: fe80::226:9eff:fef6:599/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:12812 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:6955 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:9462179 (9.4 MB) 发送字节:1003485 (1.0 MB)
中断:17
lo
Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 跃点数:1
接收数据包:571 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:571 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:44744 (44.7 KB) 发送字节:44744 (44.7 KB)
eth0 即为以太网接口,lo为本地会换接口。如无eth0信息,表明没安装以太网接口驱动。
本文主要记录当缺少有线网卡(即以太网卡)设备驱动时,如何加载
网卡驱动。
2. 确认网卡型号
终端输入:
lspci
输出信息如下:
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07)
00:01.0 PCI bridge: Intel Corporation Mobile 4 Series Chipset PCI Express Graphics Port (rev 07)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 03)
00:1c.5 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 6 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation ICH9M/M-E SATA AHCI Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce GT 130M] (rev a1)
06:00.0 Network controller: Intel Corporation PRO/Wireless 5100 AGN [Shiloh] Network Connection
07:00.0 FireWire (IEEE 1394): JMicron Technology Corp. IEEE 1394 Host Controller
07:00.1 System peripheral: JMicron Technology Corp. SD/MMC Host Controller
07:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller
07:00.3 System peripheral: JMicron Technology Corp. MS Host Controller
07:00.4 System peripheral: JMicron Technology Corp. xD Host Controller
08:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
可以看到我的网卡型号为Broadcom公司的BCM5784M
3. 下载
网卡驱动软件包
从broadcom官网下载对应驱动:
http://zh-cn.broadcom.com/support/ethernet_nic/downloaddrivers.php
无法上网时,可从别的联网电脑下载后再拷贝。
4. 安装驱动
解压后,会发现文件夹里有三个压缩文件,其中有两个是驱动的不同格式的安装包: source RPM 和 compressed tar,对应的文件名为tg3-<version>.src.rpm 和 tg3-<version>.tar.gz。
还包含一个README.TXT文件,按照README.TXT文件编译安装则可。
我选择的是安装tar格式的安装包,步骤如下:
(1)解压tar格式的安装包
tar xvzf tg3-<version>.tar.gz
(2)编译生成.o或.ko文件
cd tg3-<version>
make
生成的.o或.ko文件是与正在运行的内核想匹配的。
(3)测试并安装驱动模块
insmod tg3.o
若在2.6.X内核下,则
insmod tg3.ko (on 2.6.x kernels)
此命令需在root权限下执行。
(4)安装驱动
make install
此时再去检查
网卡驱动,可以看到以太网卡设备,正确配置后,即可联网使用!