Switching between wifi signals already added to wpa_supplicant

Hello,

This is something really basic, but I cannot find a simple answer.

Assume that I am in an area with two wifi signals, Alpha and Beta. I have already added SSIDs and passphrases to wpa_supplicant.conf, so principially I can access both of them. But the system has connected me to Alpha, maybe because of the priorities in wpa_supplicant.conf.

What is the simplest way to switch to Beta using the command line? Do I need to be root to do it?

Thank you,
Borys
 
What is the simplest way to switch to Beta using the command line? Do I need to be root to do it?
This is how I switch between my home lan and internet router (I am on 14.0-RELEASE):

As root
Code:
ifconfig wlan0 down
ifconfig wlan0 ssid <[Alpha] [Beta]>
ifconfig wlan0 up

service dhclient restart wlan0
When you see the dhclient giving up getting a link, wait a few seconds before executing the service.

The whole procedure can be also scripted, the scripts putt in a normal users $PATH, executed with su(1) (see EXAMPLES), or security/doas, security/sudo
 
I think
Hello,

This is something really basic, but I cannot find a simple answer.

Assume that I am in an area with two wifi signals, Alpha and Beta. I have already added SSIDs and passphrases to wpa_supplicant.conf, so principially I can access both of them. But the system has connected me to Alpha, maybe because of the priorities in wpa_supplicant.conf.

What is the simplest way to switch to Beta using the command line? Do I need to be root to do it?

Thank you,
Borys
A trunk would work great for this purpose (to joggle between two links) if you had two separate wifi cards.
 
According to wpa_supplicant.conf() you can set this in wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

Then it should be possible to use wpa_cli and the "enable network" command.
See also: help in the wpa_cli.

EDIT:

Actually the command inside wpa_cli is "select network".
Be careful if you do this over wireless lan - if the network switch is successful, your shell will not respond anymore.

For testing, i recommend having a shutdown -r +5 running in the background in case something goes wrong.

And also see the manual page how you can assign priorities to the different networks.

Be careful!
 
Back
Top