I have two questions, that are related.
My situation. I have two wifi networks available. Both are registered in wpa_supplicant.conf
One has priority 10, another 20.
When I turn on wlan0 it picks 20 first if available, if not - picks 10. If it picks 20, and I then switch AP off, it automatically switches to 10.
Problem #1: When it initially connected to 20 it got new IP (via DHCP) (192.168..) When I switched network 20 and it reconnected to 10 I still have same IP. (192.168..) If connect to 10 first IP is like 10.0....
Problem #2: Is there a way to make it switch to higher priority AP when it still connected to previous one? Automatically.
UPD: More info on setup
OS: standard Debian. WiFi module: "Wi-Pi"
/etc/wpa_supplicant/wpa_supplicant.conf
:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="TereHomikust"
psk="***"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
priority=10
}
network={
ssid="small device"
psk="***"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
priority=20
}
/etc/network/interfaces:
auto wlan0
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 inet dhcp
small device
network is AP running in Android phone. TereHomikust
is my home network. I want ideally for my RPi always be connected to network with highest priority. Since both networks has different IP/mask setup and both provide DHCP service - I want to have appropriate IP when connected to each of those networks.
Currently, when RPi connected to small device
with TereHomikust
also available and I kill small device
it reconnects to TereHomikust
but keeps IP that it got from first networks' DHCP.