ubuntu 16.04 连接无线网络

最近在闲置的Dell inspiron 6400上安装了ubuntu 16.04版本,安装过程此处不细说。

安装完成后,发现WIFI无法开启,通过如下方法进行无线网卡的配置。

1)查看对应的PCI设备

root@jerry:/code# lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 1 (rev 01)
00:1c.3 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 4 (rev 01)
00:1d.0 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 (rev 01)
00:1d.7 USB controller: Intel Corporation NM10/ICH7 Family USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7-M Family) SATA Controller [IDE mode] (rev 01)
00:1f.3 SMBus: Intel Corporation NM10/ICH7 Family SMBus Controller (rev 01)
03:00.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX (rev 02)  ---> 物理网卡
03:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller
03:01.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 19)
03:01.2 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 0a)
03:01.3 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 05)
0b:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01) ---> 无线网卡

可以看出,我的Dell 6400 上的无线网卡是 Broadcom 的BCM4311。ubuntu 16.04 默认的网卡驱动无法使该网卡工作,通过如下方法重新安装网卡驱动:

去掉ubuntu 16.04 默认的broadcom 无线网卡驱动:
sudo apt-get remove bcmwl-kernel-source
  
安装社区中最新的broadcom 无线网卡驱动:
sudo apt-get install firmware-b43-installer b43-fwcutter
  
查看网卡驱动配置文件:
cat /etc/modprobe.d/* | egrep 'bcm'

可以在
blacklist.conf中看到bcm43xx被加入黑名单的配置,去掉该配置。
#blacklist bcm43xx

完成后重启系统。

2)查看网卡设备

root@jerry:/code# lshw -c network
  *-network               
       description: Network controller
       product: BCM4311 802.11b/g WLAN
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:0b:00.0
       version: 01
        32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: driver=b43-pci-bridge latency=0
       resources: irq:16 memory:efdfc000-efdfffff
  *-network DISABLED
       description: Ethernet interface
       product: BCM4401-B0 100Base-TX
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: eth0
       version: 02
       serial: 00:1c:23:ab:0f:56
       capacity: 100Mbit/s
        32 bits
       clock: 33MHz
       capabilities: pm bus_master cap_list ethernet physical mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=b44 driverversion=2.0 latency=64 link=no multicast=yes port=twisted pair
       resources: irq:17 memory:ef9fe000-ef9fffff
  *-network DISABLED
       description: Wireless interface
       physical id: 2
       logical name: wlan0
       serial: 00:1e:4c:4a:ee:96
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=b43 driverversion=4.13.0-39-generic firmware=666.2 link=no multicast=yes wireless=IEEE 802.11

可以看到设备中有wlan0的无线网卡设备,配置该设备。

3)配置无线网卡设备。

有自动获取IP地址和静态配置IP地址两种方式。在/etc/network/interfaces文件进行配置。

自动获取方式添加以下内容:

auto wlan0
iface wlan0 inet dhcp
wpa-ssid xxxxxx
wpa-psk yyyyyy

静态配置IP地址方式添加如下内容:

auto wlan0
iface wlan0 inet static
address 192.168.0.150
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 xxx.xxx.xxx.xxx
wpa-ssid xxxxxx
wpa-psk yyyyyyy

其中wpa-ssid这行就是你的WIFI名称。

wpa-psk就是你的WIFI连接密码。

其中wlan0是WIFI接口名,请根据你的实际接口名填写。

4)使能网口设备

修改完成后,通过如下命令使能无线网卡

#首先关闭WIFI
sudo ifdown wlan0

#然后启用WIFI
sudo ifup -v wlan0

5)测试WIFI

root@jerry:/code# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:1e:4c:4a:ee:96  
          inet addr:192.168.0.150  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:4cff:fe4a:ee96/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12559 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8463 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6858265 (6.8 MB)  TX bytes:1155958 (1.1 MB)
root@jerry:/code# ping www.baidu.com
PING www.a.shifen.com (115.239.211.112) 56(84) bytes of data.
64 bytes from 115.239.211.112: icmp_seq=1 ttl=56 time=8.89 ms
64 bytes from 115.239.211.112: icmp_seq=2 ttl=56 time=4.25 ms
64 bytes from 115.239.211.112: icmp_seq=3 ttl=56 time=4.37 ms
64 bytes from 115.239.211.112: icmp_seq=4 ttl=56 time=9.20 ms
64 bytes from 115.239.211.112: icmp_seq=5 ttl=56 time=8.23 ms

无线网卡配置完成。

原文地址:https://www.cnblogs.com/jerry116/p/8969987.html