1. 程式人生 > >ubuntu16.04下無線網卡無法正常連網

ubuntu16.04下無線網卡無法正常連網

網卡 廠商代碼 ack 重新 通過 broadcast loopback 發送 bcm

背景:無線網卡初次連接可以正常上網,但是用了一會兒就會出現無法上網的情況

版本: Ubuntu 16.04

一.分析:

1.使用ifconfig命令發現不會顯示無線網卡,說明無線網卡被關閉,筆者輸出的信息如下:

[email protected]:~$ 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命令輸出信息(只貼出無線網卡相關的信息)如下:

[email protected]:~$ 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的輸出信息來判斷:

[email protected]:~$ 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)

[email protected]$ 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重新啟動

ubuntu16.04下無線網卡無法正常連網