ubuntu16.04下无线网卡无法正常连网
背景:无线网卡初次连接可以正常上网,但是用了一会儿就会出现无法上网的情况
版本: Ubuntu 16.04
一.分析:
1.使用ifconfig命令发现不会显示无线网卡,说明无线网卡被关闭,笔者输出的信息如下:
jello@jello:~$ ifconfig
eth0 Link encap:以太网 硬件地址 16:03:71:93:64:22
inet 地址:192.168.100.3 广播:192.168.100.255 掩码:255.255.255.0
inet6 地址: fe80::1a03:73ff:fe92:632e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:295308 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:208860 错误:1 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:394951279 (394.9 MB) 发送字节:19510963 (19.5 MB)
lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:943526 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:943526 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1
接收字节:464924375 (464.9 MB) 发送字节:464924375 (464.9 MB)
2.使用lshw命令输出信息(只贴出无线网卡相关的信息)如下:
jello@jello:~$ lshw
*-network DISABLED
description: Wireless interface
physical id: 2
logical name: wlan0 1
serial: 92 :31:e3:4a:75:f2
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=brcmsmac driverversion=4.1.0-78-generic firmware=102.304 ip=192.168.100.131 link=no multicast=yes wireless=IEEE 802.11bgn
从第2点的"*-network DISABLED"这一行可以明确无线网卡在硬件上被禁止了
3.于是打开硬件开关,但尝试了很多次都没成功,通过rfkill的输出信息来判断:
jello@jello:~$ sudo rfkill list all
[sudo] jello 的密码:
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
从"Hard blocked: yes"这一行可以看出无线网卡在硬件上被block
4.通过第3点开始怀疑无线网卡的驱动是否安装正确
二.安装无线网卡驱动:
1.卸载之前安装的无线网卡驱动(如果之前安装了的情况下,否则请无视):
sudo apt-get purge firmware-b43-installer
sudo apt-get purge bcmwl-kernel-source
2.获取无线网卡的PCI.ID (笔者的无线网卡品牌是broadcom,所以指定厂商代号为14e4)
jello@jello$ lspci -nn -d 14e4:
09:00.0 Network controller [0280]: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)
从以上信息中获取到关键信息为:[14e4:4727] (rev 01)
-nn 选项是只显示指定的厂商代码对应的设备
-d 选项是显示厂商代号和设备代号,同时显示数字和名称
3.更新ubuntu的PCI.IDs列表:
3.1sudo apt-get update (首先更新软件包索引)
3.2sudo update-pciids (如果一直没有响应,那就将其中断),直接替换原来的/usr/share/misc/pci.ids文件,命令如下:
cd /usr/share/misc/
sudo mv pci.ids pci.ids.orig
然后从http://pci-ids.ucw.cz/下载最新的pic.ids文件
将下载好的pci.ids文件复制到/usr/share/misc/目录下(由于笔者认为目前的无线网卡硬件不是很新,因此无线网卡的信息在原来的pci.ids文件中是存在的,因此并没有手动去更新pci.ids文件)
4.安装对应的无线网卡驱动,从下表即可获得对应驱动的软件包名
PCI.ID 16.04 LTS 17.10+
------------------------------------------------------------------------------------
14e4:0576 Special Case #1 UNKNOWN
14e4:4301 firmware-b43-installer firmware-b43-installer
14e4:4306 firmware-b43-installer firmware-b43-installer
14e4:4306 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4306 rev 03 firmware-b43-installer firmware-b43-installer
14e4:4307 firmware-b43-installer firmware-b43-installer
14e4:4311 firmware-b43-installer firmware-b43-installer
14e4:4311 rev 01 firmware-b43-installer firmware-b43-installer
14e4:4312 firmware-b43-installer firmware-b43-installer
14e4:4313 firmware-b43-installer firmware-b43-installer
14e4:4315 firmware-b43-installer firmware-b43-installer
14e4:4315 rev 01 firmware-b43-installer firmware-b43-installer
14e4:4318 firmware-b43-installer firmware-b43-installer
14e4:4318 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4319 firmware-b43-installer firmware-b43-installer
14e4:4320 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4320 rev 03 firmware-b43-installer firmware-b43-installer
14e4:4321 firmware-b43-installer firmware-b43-installer
14e4:4324 firmware-b43-installer firmware-b43-installer
14e4:4325 firmware-b43-installer firmware-b43-installer
14e4:4328 firmware-b43-installer firmware-b43-installer
14e4:4329 bcmwl-kernel-source bcmwl-kernel-source
14e4:432a bcmwl-kernel-source bcmwl-kernel-source
14e4:432b bcmwl-kernel-source bcmwl-kernel-source
14e4:432c bcmwl-kernel-source bcmwl-kernel-source
14e4:432d bcmwl-kernel-source bcmwl-kernel-source
14e4:4331 firmware-b43-installer firmware-b43-installer
14e4:4335 firmware-b43-installer firmware-b43-installer
14e4:4350 firmware-b43-installer firmware-b43-installer
14e4:4353 Special Case #1 UNKNOWN
14e4:4353 rev 01 Special Case #1 UNKNOWN
14e4:4357 Special Case #1 UNKNOWN
14e4:4358 bcmwl-kernel-source bcmwl-kernel-source
14e4:4359 bcmwl-kernel-source bcmwl-kernel-source
14e4:4360 bcmwl-kernel-source bcmwl-kernel-source
14e4:4365 bcmwl-kernel-source bcmwl-kernel-source
14e4:4365 rev 01 bcmwl-kernel-source bcmwl-kernel-source
14e4:43a0 bcmwl-kernel-source bcmwl-kernel-source
14e4:43ae rev 02 UNKNOWN UNKNOWN
14e4:43b1 bcmwl-kernel-source bcmwl-kernel-source
14e4:43b1 rev 03 bcmwl-kernel-source bcmwl-kernel-source
14e4:43c3 rev 04 UNKNOWN Special Case #2
14e4:4727 bcmwl-kernel-source bcmwl-kernel-source
14e4:4727 rev 01 bcmwl-kernel-source bcmwl-kernel-source
14e4:a962 firmware-b43-installer firmware-b43-installer
------------------------------------------------------------------------------------
4.1从上表中可以看到bcmwl-kernel-source与14e4:4727 rev 01对应,因此安装命令如下:
sudo apt-get install bcmwl-kernel-source
4.2重新启动