BCM4312等在ubuntu下用ap-hotspot建立可用的WIFI热点


2015-9-28更新

理论上BCM4306 (rev 03), BCM4309, BCM4311, BCM4312, BCM4318, BCM4322, BCM4331, BCM43224和BCM43225等均可使用b43驱动建立wifi热点,其它bcm43xx型号可参考WifiDocs/Driver/bcm43xx中的Drivers available in Ubuntu列表。

最初,我按照http://jingyan.baidu.com/article/03b2f78c5a3c975ea237ae09.html ,完成后发现手机搜索不到建立的热点,百度后得知需要给手机打ad-hoc补丁,但没有找到适合的版本。

然后使用ap-hotspot,在配置时出现 Your wireless card does not support Access Point mode 

因为我的网卡在windows下是可以开启热点的,于是继续查找原因,最终得以解决。



下面是具体操作过程(系统环境 ubuntu14.04LTS)


1.安装配置无线ap,若已配置可省略这步。

参考自http://jingyan.baidu.com/article/d8072ac4414864ec95cefdaf.html

添加含有ap-hotspot的资源

sudo add-apt-repository ppa:nilarimogard/webupd8


更新资源(我用的校园网,不开代理在这一步总是失败,可省略)

sudo apt-get update


之前安装了ap-hotsopt或者hostapd的需要卸载

sudo apt-get remove hostapd


安装合适的hostapd版本(链接已更新)

64位:

cd /tmp
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_amd64.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd
32位:

cd /tmp
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_i386.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd


安装ap-hotspot

sudo apt-get install  ap-hotspot


如找不到包请在https://launchpad.net/~nilarimogard/+archive/webupd8/+sourcepub/3904172/+listing-archive-extra页面最下方下载安装



配置 网络  ap的名字与密码

sudo ap-hotspot configure
如果网卡不支持,会在这里出现Your wireless card does not support Access Point mode



2.接下来查看网卡的具体信息。

参考自https://blog-kongkong.rhcloud.com/?p=65


首先查看你的当前网卡驱动到底支不支持 AP 模式,终端输入:

ifconfig


输出信息中很容易成可以看出你的无线网卡是哪个,比如我的信息是:

eth0      Link encap:以太网  硬件地址 00:21:70:e9:ac:06  
          inet 地址:10.8.22.67  广播:10.8.22.255  掩码:255.255.255.0
          inet6 地址: fe80::221:70ff:fee9:ac06/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:17449 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:21695 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:10261495 (10.2 MB)  发送字节:4195109 (4.1 MB)
          中断:17 

lo        Link encap:本地环回  
          inet 地址:127.0.0.1  掩码:255.0.0.0
          inet6 地址: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  跃点数:1
          接收数据包:3608 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:3608 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:0 
          接收字节:285939 (285.9 KB)  发送字节:285939 (285.9 KB)

wlan0     Link encap:以太网  硬件地址 00:22:5f:b3:a3:81  
          inet6 地址: fe80::222:5fff:feb3:a381/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)

我的无线网卡是 wlan0


然后查看wlan0的具体信息

ethtool -i wlan0
我的输出结果第一行是
driver: wl0
说明驱动是wl0


接下来确定当前网卡驱动是否支持AP模式

sudo iwconfig wlan0 mode master
Password: 
输出为

Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.
执行错误,所以不支持AP模式


有些新的网卡用的是 mac80211 framework,所有要用以下方法测试,终端输入:

iw list
在Supported interface modes,我的输出为

Supported interface modes:
		 * IBSS
		 * managed
没有AP项,可见不支持AP模式



3.最后是解决的办法


首先查看无线网卡驱动芯片

lspci -vvnn | grep 14e4
我的输出

09:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM5755M Gigabit Ethernet PCI Express [14e4:1673] (rev 02)
0c:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01)
从第二行得知,我的Chip ID是BCM4312,PCI-ID是[14e4:4315]


WifiDocs/Driver/bcm43xx或者http://wireless.kernel.org/en/users/Drivers/b43中得知,b43支持BCM4312,

而b43在http://wireless.kernel.org/en/users/Drivers中显示是支持AP模式的,因此我们可以改用b43驱动。

sudo apt-get install firmware-b43-installer


然后进行驱动切换,先关闭当前驱动

sudo modprobe -r wl

启用b43

sudo modprobe b43

可以看见,wifi指示灯先灭后亮,说明切换完成


运行

iw list
在Supported interface modes输出为
Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * WDS
		 * monitor
		 * mesh point
可见已支持AP


接下来配置AP的SSID和密码

sudo ap-hotspot configure


如下
hellowd93@hellowd93-PC:~$ sudo ap-hotspot configure
Detecting configuration...
Detected eth0 as the network interface connected to the Internet. Press ENTER if this is correct or enter the desired interface below (e.g.- eth0, ppp0 etc.):

Detected wlan0 as your WiFi interface. Press ENTER if this is correct or enter the desired interface (e.g.- wlan1):

Enter the desired Access Point name or press ENTER to use the default one (myhotspot):
ubuntuWIFI
Enter the desired WPA Passphrase below or press ENTER to use the default one (qwerty0987):
Oct11CSDN        
hellowd93@hellowd93-PC:~$ 


因为我使用的Dr.com校园认证客户端,第三行etho是我的本地连接,不变可Enter

下面wlan0是我用来做AP的无线网卡,不变可Enter

接下来是SSID,用作热点的名字

最后一项是认证密码


配置完成后,如果启用了防火墙,关闭之

sudo ufw disable


最后,启用热点

sudo ap-hotspot start


关闭热点为

sudo ap-hotspot stop


我在使用ubuntu-gnome15.04操作系统建立热点时在启用热点总是失败,替换了hostapd版本都不行。后来发现系统里有两个网络管理器,但是都不起作用,我的校园网是修改了系统配置文件才能用。所以这里应该有问题

然后先在软件中心下载了一个gui的网络管理器,像wicd,然后在终端执行

sudo apt-get remove network-manager network-manager-gnome

卸载了系统自带的网络管理器再重新安装hostapd和ap-hotspot就可以啦




大功告成,手机现在可以连接使用建立的wifi了



PS:本人第一篇博客,欠妥之处,望不吝指教。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值