1

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

AtyKlaxas
  • 21
  • 3
  • I normally set the priority higher for the hotspot on my iPhone, then if I turn on my phone's hotspot it connects to that and then reverts to my home router when my phone hotspot is off. – Mark Setchell Aug 24 '22 at 16:14
  • 1
    while searching about priorities, I found this https://raspberrypi.stackexchange.com/questions/58304/how-to-set-wifi-network-priority – AtyKlaxas Aug 24 '22 at 16:30

0 Answers0