4

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
update_config=1

network={
ssid="SSID"
psk="mypasswordishere"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

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

Been frustrated over this...

2 Answers2

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
update_config=1
country=AU

network={
        ssid="YOUR_SSID"
        psk="YOUR_PSK"
}

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

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

electron1979
  • 121
  • 11
0

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.

PaulF8080
  • 307
  • 1
  • 7