I have a particular network that requires me to use a Raspberry as a bridge between wifi and ethernet
This is my wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
#country=FR
# phone connection share
network={
ssid="wifi1"
psk="password"
}
# internet box
network={
ssid="wifi2"
psk="password"
}
wifi1 is a phone connection share
wifi2 is an internet box
Actually, to switch from wifi2 to wifi1
I activate wifi1 manually and I do these commands on the raspberry
# disconnect from wifi2
sudo ifconfig wlan0 down
# wait...
sudo ifconfig wlan0 up
# verify the wifi is wifi1
iwconfig wlan0
To disconnect from my phone share, i disable it from the phone
My problem is: how to change wifi properly ?
is it the only method or is there a command ?
Edit:
while searching about priorities, I found this
https://raspberrypi.stackexchange.com/questions/58304/how-to-set-wifi-network-priority
and I found these commands
wpa_cli -i wlan0 list_networks
network id / ssid / bssid / flags
0 wifi1 any [CURRENT]
1 wifi2 any
wpa_cli -i wlan0 select_network 1
wpa_cli -i wlan0 enable_network all
and it answers my questions