ubuntu16通过命令行开启热点

在ubuntu 16中,由于官方不再添加ap-hostpot这个库,所以再使用命令行开启热点的方法就麻烦了很多,网上搜索了很多添加PPA的方式,也都不可行,查了很多之后,终于找到了正确的通过ap-hostpot开启热点的方法。

一、安装ap-hostpot

hostapd是ap-hostpot的基础,所以在安装ap-hostpot还需要安装hostapd:

pi@bpi-iot-ros-ai:~/Desktop$ sudo apt-get install hostapd

然后在https://pkgs.org/ubuntu-12.04/webupd8-i386/ap-hotspot_0.2.1-1~webupd8~1_all.deb.html下载ap-hostpot的安装包并安装:

pi@bpi-iot-ros-ai:~/Desktop$ sudo dpkg -i ap-hotspot_0.3-1~webupd8~4_all.deb 

二、第二步:配置ap-hotspot

pi@bpi-iot-ros-ai:~/Desktop$ sudo ap-hotspot configure
[sudo] password for pi: 
rm: cannot remove '/etc/dnsmasq.d/ap-hotspot.rules': Is a directory
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):
pi
//wifi用户名

Enter the desired WPA Passphrase below or press ENTER to use the default one (qwerty0987):
12345678 
//wifi密码

第三步:启动wifi

pi@bpi-iot-ros-ai:~/Desktop$ sudo ap-hotspot start 

但是这个时候我们发现wifi并没有打开,显示如下信息:

Starting Wireless Hotspot...

这是因为hostapd不对造成的,ubuntu 16中的hostapd是有一些小问题的,具体什么情况,我也不是很清楚,这时候我们可以在http://old-releases.ubuntu.com/ubuntu/pool/universe/w/wpa/上下载旧版的hostapd,然后安装:

pi@bpi-iot-ros-ai:~/Desktop$ sudo dpkg -i hostapd_1.0-3ubuntu1_armhf.deb 

这里最好是执行下面的命令防止update时hostapd更新:

sudo apt-mark hold hostapd

然后重新安装ap-hotspot并重新配置wifi信息。

四、启动wifi

pi@bpi-iot-ros-ai:~/Desktop$ sudo ap-hotspot start 

当显示下面的信息时,表示我们的wifi发射成功:

Starting Wireless Hotspot...
Wireless Hotspot active

注:

pi@bpi-iot-ros-ai:~$ ap-hotspot 

    grep: /proc/4235/environ: No such file or directory
    Usage:  ap-hotspot [argument]

    start          start wireless hotspot       //打开wifi
    stop           stop wireless hotspot        //关闭wifi
    restart        restart wireless hotspot     //重启wifi
    configure      configure hotspot            //配置wifi
    debug          start with detailed messages //dubug模式
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值