Friday, June 08, 2007

Configuring WPA manually

Configuring WPA is Ubuntu is no problem if NetworkManager works flawlessly. However, sometimes it doesn't. Here's how to configure WPA from the command line:
  1. Get wpa supplicant sudo aptitude install wpasupplicant
  2. Run wpa_passphrase which reads stdin and outputs the PSK that you'll need
  3. Create a configuration file, say /etc/wpa_supplicant.conf, with the the text following this numbered list
  4. sudo wpa_supplicant -B -D wext -i eth0 -c /etc/wpa_supplicant.conf (B for background, D for driver (wext is a generic linux driver, ipw2100 does not work), i for interface, c for path to conf file)
  5. You should be connected at this point. Run dhclient to request an IP address from the server. ping something to make sure you can reach the outside.
  6. (optional) This process can be automated on startup by editing the /etc/network/interfaces file appropriately
ctrl_interface=/var/run/wpa_supplicant

network={
ssid="My Network"
key_mgmt=WPA-PSK
psk=<generated passphrase>
}
As always, look at the man pages for more details: man wpa_supplicant and man wpa_supplicant.conf and man wpa_passphrase