Configuring Wireless With wpa_cli

This article is for folks who are choosing not to use NetworkManager for their wireless.
If you are running FluxBox or some other lightweight window manager, you may find it useful to configure wireless in the manner described below.
If you are interested in having wireless internet without having to run X at all, this article may also be of interest.

You may get back something like:

root      1337  0.0  0.0  28268  1468 ?        Ss   14:23   0:00 wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf
root      4146  0.0  0.0   7136   968 pts/1    S+   16:53   0:00 grep wpa

It needs to look like:

ctrl_interface=/var/run/wpa_supplicant
update_config=1

Change it to that, removing all other lines and save it.

This will work for most people. There are other driver options like nl80211, but I have not had good luck with them.

wpa_supplicant should start up successfully. If you get a message about an RFKILL error you can probably ignore it.

It should start up and report that wpa_supplicant is running.

scan should return OK and scan_results should list your wireless router after a short wait.

add_network should return 0. If it returns some other number you may want to run “remove_network” on the numbers below the returned value and start over.

If you only have one wireless network, it really should be network zero.

The last command should save your config and return OK. If it says FAIL you may have a driver issue or have mistyped something in your wpa_supplicant startup command.
You can now quit wpa_cli by typing “quit” and hitting enter.

Just remove “update_config=1” from the file.
Your SSID and the password should now be written into the config file.

That should get you online.

Sources