1. run wpa_supplicant first:
wpa_supplicant -i wlan0 -D wext -c /tmp/wpa_supplicant.cfg –B
2. run wpa_cli(cmd line tool) to connect to ssid:
a) scan: to scan the neighbor AP
b) scan_result: show the scan result
c) status: check out the current connection information
d) terminate: terminate the wpa_supplicant;
e) quit:
f) add_network: it will return a network id;
g) set_network: example, set_network 0 ssid “hztb”, set_network 0 key_mgmt NONE;
h) disable_network:
i) enable_network:
3. how to config wpa_supplicant.cfg
you can issue "echo \"ctrl_interface=/var/run/wpa_supplicant\" > /tmp/wpa_supplicant.cfg" to create a wpa_supplicant.cfg
4. get ip by dhclint:
you can issue "dhclint wlan0" to get ip from dhcp server.
5. auth-mode:
MODE wpa_cli parameter
---------------------------------------------------------------------------------------------
WPA-PSK-TKIP: key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
WPA-PSK-AES: key_mgmt=WPA-PSK
proto=WPA
pairwise=CCMP
group=CCMP
--------------------------------------------------------------------------------------------
WPA2-PSK-TKIP: key_mgmt=WPA2-PSK
proto=WPA2
pairwise=TKIP
group=TKIP
WPA2-PSK-TKIP-AES: key_mgmt=WPA2-PSK
proto=WPA
pairwise=CCMP
TKIP group=TKIP
---------------------------------------------------------------------------------------------
then you can access to internet by ssid.