Wpa supplicant

wpa_supplicant is a Wifi supplicant to handle authentication.

Emerge
After USE flags have been reviewed, install using Portage's emerge command:

Configuration
The necessary wireless device drivers need to be installed. For usage with a single wireless interface only one configuration file will be needed:

To allow unprivileged users to control the connection using wpa_gui / wpa_cli, make sure  and.

Setup for dhcpcd as network manager
No special setup is needed for operating wpa_supplicant with dhcpcd. Only old wpa_supplicant-2.0-r2 or older need "env wpa_supplicant_driver=nl80211" in.

Setup for Gentoo net.* scripts
Tell the network script to use wpa_supplicant:

When using wpa_supplicant 2.1 or later, second line is no longer required. As of 2.1, wpa_supplicants defaults to using nl80211.

After configuration below it is a good idea change the permissions to ensure that WiFi passwords can not be viewed in plaintext by anyone using the computer:

Using wpa_gui
The simplest way to configure wpa_supplicant is by using its simple (but sufficient for most uses) user interface called wpa_gui. To enable it, build wpa_supplicant with the the  flag enabled.

Using wpa_cli
Wpa_supplicant also has a command-line user interface. Typing wpa_cli starts its interactive mode with tab-completion.

Typing help at this prompt will list the commands available. More details on how to connect can be found in the Arch Linux wiki.

Editing manually
wpa_supplicant can be configured manually. This works well if the computer does not need to connect to many different access points.

Examples can be found in the wpa_supplicant.conf(5) man page as well as the example wpa_supplicant.conf in the documentation directory (e.g. ).

WPA2 with wpa_supplicant
Connecting to any wireless access point serving YourSSID

Using bssid to specify which access point it should connect to using its MAC address, in case there are repeaters in place. Remember to use wpa_passphrase [passphrase] to generate the psk

Troubleshooting
In case it does not work as expected try some of the following and analyze the output.

Enable Logging
By default, wpa_supplicant performs very little debugging without the  flag enabled.

Now, within one terminal issue a tail command to monitor output and restart the net.wlan0 device in another:

Can not connect to hidden SSID
This plagued me for several days and I recently found, by an accidental firmware settings reset on my DD-RWT Linksys router, that the settings within DD-WRT can cause havoc for some reason.

So, basically, if you cannot connect to an Access Point (AP) or wireless router using wpa_supplicant, try reseting the AP or wireless router's settings to factory defaults. I know it's a drastic solution, but it solved my issues with trying to connect with a ath9k AR9462 wireless device and WRT54G DD-WRT wireless router [Firmware: DD-WRT v24-sp2 (11/02/09) std]. Some symptoms were, SSID was not broadcasted after setting broadcast to enabled. Setting encryption mode to WPA, didn't allow selecting both WPA Algorithms, and only selected one type. Also, selecting WPA, prevented broadcasting the SSID. Seems to be a firmware glitch and any DD-WRT bug submitter should probably submit this as a possible bug.

External resources

 * HOWTO: Remote access point with wpa_supplicant (Gentoo Forums)