I have special demands and need to manually control which Wi-Fi access point I connect to on my Linux machine. The machine is a Raspberry Pi running Raspbian (Debian) but I don't think the hardware platform really matters in the contexts of this question.

Now I am using wpa_supplicant as my wireless network manager and it auto connects my machine to some AP with its own logic. In /etc/network/interfaces I have

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

In /etc/wpa_supplicant/wpa_supplicant.conf I have just a few pre-configured APs and their PSK.

I have done some brief search already. sudo iwconfig wlan0 essid <SSID> key s:<PSK> did NOT work for me. It did disconnect wlan0 from the old AP for a few seconds but soon wlan0 got connected to the old one again. I am wondering if I have made some mistake when executing this, or if wpa_supplicant conflicts with manual configuration.

Is it possible that either of these can be realized:

  1. It connects to APs identified in wpa_supplicant automatically, but I can manually change the one it connects to as long as the new one is in range?
  2. I control if it connects to APs identified in wpa_supplicant automatically. When I don't want it to, I am able to make it connect to any AP in range.
  • Maybe you should just remove allow-hotplug wlan0? – Ortomala Lokni Jul 27 '15 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.