Skip to content

Instantly share code, notes, and snippets.

@helloimalemur
Last active July 6, 2024 17:59
Show Gist options
  • Save helloimalemur/95849a5ba91f229c4487044e575aec26 to your computer and use it in GitHub Desktop.
Save helloimalemur/95849a5ba91f229c4487044e575aec26 to your computer and use it in GitHub Desktop.
wpa_supplicant

Configure wireless on Debian linux / raspberry pi

wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf 
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
        ssid="myssid"
        #psk="mypass!"
        psk=hash
        priority=5
}
network={
        ssid="myssid"
        #psk="mypass"
        psk=hash
        priority=4
}

To debug what wpa_supplicant is doing, wpa_cli status will give information about whether wpa_supplicant still thinks it's connected to an AP, or searching for a new AP.

Wpa_supplicant needs to be in roaming mode to automatically switch between networks. You enable roaming by using a wpa-roam entry after the iface stanza in /etc/network/interfaces, and put all the networks in a wpa_supplicant.conf file (typically /etc/wpa_supplicant/wpa_supplicant.conf). Details can be found in README.modes or README.modes.gz in the wpa_supplicant documentation.

Hidden access points (APs) will cause trouble for two reasons: One the hand, wpa_supplicant will be need to actively configured to scan for all of them (and I don't know the details on how to configure that). On the other hand, the WLAN client will have problems to determine if the connection is still valid or not, because the AP doesn't send out beacons which could be measured. So all the client sees is no answer to transmitted packets, which could also be caused by problems somewhere else in the network. The client will timeout the connection eventually, but that can take several minutes.

Also, hidden APs don't really improve security: Traffic between a hidden AP and a client can be sniffed, giving away the existence of the AP. A client actively scanning for an AP also gives away the existence (and as it's actively scanning for all hidden APs it knows of, it gives even more information).

So the easiest solution is to make all APs non-hidden in case they cause problems.

wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment