I have a raspberry pi running raspbian. I got it connected to my home network via wifi without issue.

However, after returning home from work with the pi (it was powered on the whole day), it did not auto-reconnect to the network.

Here is my /etc/network/interfaces configuration:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

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

And here is my /etc/wpa_supplicant/wpa_supplicant.conf configuration:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Does anyone know how to make it auto-reconnect to a wifi network when it is in range?

Been frustrated over this...

  • 2 alternatives. (bash script or configure settings) raspi.stackexchange: how to auto reconnect wifi
    – Alireza7am
    Commented Jan 11, 2016 at 19:41
  • If you left the network settings as they were it would work. See raspberrypi.stackexchange.com/a/37921/8697 If you have some reason to use the old settings use wpa-roam (this is from memory) but you also need to fix the other errors in your file.
    – Milliways
    Commented Jan 11, 2016 at 22:43
  • 1
    iface wlan0 inet dhcp should probably be iface wlan0 inet manual. But I'm not quite sure I understand your question. Do you want it to autoconnect to different networks or only automatically connect to your home network. Your wpa_supplicant.conf doesn't seem right either. I think auth_alg=OPEN is for WEP, but key_mgmt is set to WPA-PSK Commented Jan 12, 2016 at 10:58

2 Answers 2


This is how I do it It works for Pi0, Pi, Pi2 & Pi3 (I haven't tried a Pi3 B+) and the latest images, and has worked for years!:

To configure Wi-Fi, copy /etc/wpa_supplicant/wpa_supplicant.conf from an existing device or create a new wpa_supplicant.conf like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


and copy it into the boot partition (accessible via most Windows machines).

Note: You may want to change your county ID for compliance. Done!


Wicd adds a daemon that does that. When you connect, you can make that WiFi spot auto connect. You can also make any spot with the same ID auto connect. There is a curses version for terminals.

  • Do you have more details to make this a workable answer for OP?
    – dbmitch
    Commented Nov 20, 2016 at 23:49
  • All I did was install wicd because it was on my beagle bone. It is a self explanatory graphic interface that puts an icon on the top right of the screen on the bar. Each connection ID has a properties window.
    – PaulF8080
    Commented Nov 21, 2016 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.