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