1. 操作指令
操作指令 | 说明 | 备注 |
---|---|---|
softap_up SSID [PSK] | 启动AP | 其中psk为可选项,一般不设置 |
softap_down | 关闭AP | |
cat /etc/wifi/hostapd.conf | 查看AP的配置和SSID | 可进行手动修改该文件 |
cat /etc/dnsmasq.conf | 修改AP模式的网关IP地址 |
2. 启动AP
指令: softap_up SSID [PSK]
启动信息:设置了密码
root@TinaLinux:/usr# softap_up Jimmy1 12345678
***************************
Start hostapd test!
***************************
Start to reload firmware!
Enter: wifi_get_fw_path function, fw_type=1,Eneter: wifi_change_fw_path, fwpath = /lib/firmware/fw_bcm43438a0_apsta.bin.
Softap fwReload - Ok
Message is: OK
Reload firmware finished!
wpa2-psk!
Start to set softap!
Message is: OK
Set softap finished!
killall: wpa_supplicant: no process killed
Start to start softap!
Configuration file: /etc/wifi/hostapd.conf
nl80211: Could not re-add multicast membership for vendor events: -2 (No such file or directory)
Using interface wlan0 with hwaddr dc:f5:05:a8:b4:a4 and ssid "Jimmy1"
VLAN: vlan_set_name_type: SET_VLAN_NAME_TYPE_CMD name_type=2 failed: No error information
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
SoftAP started successfullyMessage is: OK
Start softap finished!
Having catch sig_chld!
Having catch sig_chld!
Having catch sig_chld!
Having catch sig_chld!
Having catch sig_chld!
Having catch sig_chld!
Having catch sig_chld!
***************************
Hostapd test successed!
***************************
3. 关闭AP
指令:softap_down
打印信息
root@TinaLinux:/usr# softap_down
***************************
Start to shutdown hostapd!
***************************
No argv[1], take default action to reload fw for sta mode
Start to reload firmware!
Enter: wifi_get_fw_path function, fw_type=0,Eneter: wifi_change_fw_path, fwpath = /lib/firmware/fw_bcm43438a0.bin.
Softap fwReload - Ok
Message is: OK
Reload firmware finished!
wlan0: interface state ENABLED->DISABLED
wlan0: AP-DISABLED
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
***************************
Shutdown Hostapd successed!
***************************
4. 查看AP的SSID
指令:cat /etc/wifi/hostapd.conf
root@TinaLinux:/usr# cat /etc/wifi/hostapd.conf
interface=wlan0
driver=nl80211
ctrl_interface=/etc/wifi/hostapd
ssid=Jimmy1
channel=6
ieee80211n=1
hw_mode=g
ignore_broadcast_ssid=0
wpa=2
rsn_pairwise=CCMP
wpa_psk=d69b3f6f082b4d72cce00a8b7d77d17efa2388cb6d07d9da5075ae2f99b90e1e
5. 查看连接AP的设备
指令:
cat /tmp/dhcp.leases
root@TinaLinux:/tmp/lib# cat /tmp/dhcp.leases
1605522948 e0:89:7e:a2:62:8c 192.168.99.3 Jimmy 01:e0:89:7e:a2:62:8c
1605522583 2c:6f:c9:33:9a:49 192.168.99.2 * 01:2c:6f:c9:33:9a:49
6. 修改AP模式的网关IP地址
修改
/etc/dnsmasq.conf
文件的dhcp-range
# Change the following lines if you want dnsmasq to serve SRV
# records.
...
#cname=bertand,bert
resolv-file=/etc/resolv.dnsmasq.conf
strict-order
cache-size=102400
interface=wlan0
min-cache-ttl=3600
dhcp-range=192.168.1.2,192.168.1.255
all-servers
dhcp-sequential-ip
Notice:
此处的修改,一定是伴随着softap的修改,否则softap启动后,DHCP无法分配动态IP,导致PC无法连接板卡的AP