ubuntu下设置一个wifi热点

我使用的是ap-hotspot,比较简单,命令行一共就三四步的样子。先来提一下配置的方法,然后讲我遇到的问题。
第一步:安装hoseapd和ap-hotspot。

sudo apt-get update
sudo apt-get install postapd
sudo apt-get install ap-hotspot

第二步:配置ap-hotspot

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):
//输入wifi名称

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

第三步:热点启动

sudo ap-hotspot start

等到出现wireless hotspot active,这样一个wifi就启动了。
遇到的问题:
1、启动了以后进程一直阻塞着。
一直阻塞的话就是不成功,去/tmp/文件夹下查看hostapd的日志文件显示如下

Configuration file: /etc/ap-hotspot.conf                                                                                       
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan0 wasn't started

发现问题是nl80211后边这一串。解决办法是

//这两行的意思是先关闭wlan,然后关闭接口让ifconfig可以工作
sudo nmcli nm wifi off 
sudo rfkill unblock wlan
//用ifcongif升级wlan,然后允许一秒的延迟
sudo ifconfig wlan0 10.15.0.1/24 up
sleep 1
//重启设备
sudo service isc-dhcp-server restart
sudo service hostapd restart

问题解决。
这几个命令要在普通用户下运行,sudo权限个root用户下运行并不一样。
2、启动了以后终端提示Another process is already running
这是因为已经启动过一遍了,再启动一遍就会提示这个错误。解决办法是去临时文件夹下删除hotspot.pid文件。

sudo rm /tmp/hptspot.pid
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值