本文共 1533 字,大约阅读时间需要 5 分钟。
我使用的是ap-hotspot,比较简单,命令行一共就三四步的样子。先来提一下配置的方法,然后讲我遇到的问题。
第一步:安装hoseapd和ap-hotspot。sudo apt-get updatesudo apt-get install postapdsudo apt-get install ap-hotspot
第二步:配置ap-hotspot
sudo ap-hotspot configureDetecting 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 modenl80211 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 upsleep 1//重启设备sudo service isc-dhcp-server restartsudo service hostapd restart
问题解决。
这几个命令要在普通用户下运行,sudo权限个root用户下运行并不一样。 2、启动了以后终端提示Another process is already running 这是因为已经启动过一遍了,再启动一遍就会提示这个错误。解决办法是去临时文件夹下删除hotspot.pid文件。sudo rm /tmp/hptspot.pid
转载地址:http://vpbsi.baihongyu.com/