1. 添加过程
# wpa_cli -i wlan0 add_network
1
# wpa_cli -i wlan0 set_network 1 ssid '"aaa"'
OK
# wpa_cli -i wlan0 set_network 1 psk '"aaa"'
FAIL
# wpa_cli -i wlan0 set_network 1 psk '"aaaabbbb"'
OK
# wpa_cli -i wlan0 set_network 1 priority 5
OK
# wpa_cli -i wlan0 save_config
conf内容
ctrl_interface=/var/run/wpa_supplicant
update_config=1
network={
ssid="aa"
psk="87654321"
priority=5
}
network={
ssid=“aaa"
psk="aaaabbbb"
priority=5
}
2. network_id
在list出来的项基础上加1。机器重启后重新从0开始排序。
例:
删除操作和添加操作后当前状态:
# wpa_cli -i wlan0 list
network id / ssid / bssid / flags
1 xcv any [CURRENT]
2 cvb any
3 aaaa any
4 qx any
5 any [DISABLED]
6 aaa any [DISABLED]
机器重启后:
# wpa_cli -i wlan0 list
network id / ssid / bssid / flags
0 xcv any [CURRENT]
1 cvb any
2 aaaa any
3 qx any
4 aaa any [DISABLED]