I can't get my raspberry pi to work properly with the wlan.
The behaviour I'd like to obtain is: At boot tries to connect to a wlan if there is one available get a ip through DHCP and it's fine, otherwise remain searching for a wlan, and when there is one available connect to it and pick an IP with DHCP. This is the behaviour of my phone, straightforward.
I have Alpine Linux on Raspberry Pi 1.
Here my /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default net dhcp
here wpa_supplicant.conf
update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="ssid1"
psk="pass"
}
network={
ssid="ssid2"
psk="pass"
}
The behaviour I get is that ok, at boot it finds a listed wlan and connects to it but without sending dhcp, so I don't have any address. The same happens if the wlan is found at any time: it connects without sending dhcp discovery. If I try (at any time):
ifup wlan0
then DHCP discovery is sent and everything works properly, but I want to have this automatically!
Is there a way to run ifup wlan0
when wpa_supplicant connects to a new wlan? Because if I have an old IP and wpa_supplicant changes wlan then the old IP is not working properly.