linux下启动AP热点时出错
1.启动hostapd,在终端下输入sudo ./hostapd hostapd.conf (注意:使用到的hostapd和hostapd.conf都处在当前工作目录下)
1.2.在执行1之后会出现以下错误:
Configuration file: hostapd.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
1.3.如果不以超级用户root运行的话,如: ./hostapd hostapd.conf ,会出现以下错误信息:
Configuration file: hostapd.conf
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
Could not set interface wlan0 flags (DOWN): Operation not permitted
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
2.解决方法:
terminal中输入:
2.1 sudo nmcli nm wifi off
2.2 sudo rfkill unblock wlan
2.3 sudo ifconfig wlan0 192.168.1.1/24 up (注意:我配置主机的ip地址为192.168.1.1)
2.4 sudo ./hostapd hostapd.conf
2.5 在2.4执行之后会出现以下信息即表示成功启动AP热点。
Configuration file: hostapd.conf
nl80211: Could not re-add multicast membership for vendor events: -2 (No such file or directory)
Using interface wlan0 with hwaddr 7c:8f:ed:36:45:fa and ssid "JelloSmith"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED