Tag Archives: wpa_supplicant

Instant network connection with wpa_supplicant

The snippet below shows how to make wpa_supplicant taking your ssid and passphrase directly from command line. This is very handy for instant connections, e.g. if your network manager was broken during upgrades or to obtain the driver for your network card.

  • Authenticate using WPA/WPA2 in foreground (better for debugging):
1
2
nohup wpa_passphrase <ssid> <passphrase> \
| wpa_supplicant -i wlan0 -c /dev/stdin 2>&1 &
  • Or authenticate using WPA/WPA2 in background:
1
2
wpa_passphrase <ssid> <passphrase> \
| wpa_supplicant -B -i wlan0 -c /dev/stdin
  • To inquire the name of the access point (ssid). The link has to be up (ip link set wlan0 up):
1
iwlist wlan0 scanning | egrep 'Cell |Frequency|ESSID'
  • To obtain an IP via DHCP:
1
dhclient wlan0