Code: Select all
/etc/wpa_supplicant/wpa_supplicant.conf
Code: Select all
/etc/wpa_supplicant/wpa_supplicant.conf
Code: Select all
network={
ssid="wifssidnumberone"
Priority=35
psk="secretpassword"
}
network={
ssid="numbertwoSSID"
priority=70
psk="pswdsecret"
}
Code: Select all
network={
ssid = "wifi_A"
psk = "passwordOfA"
priority = 1
}
network={
ssid = "wifi_B"
psk = "passwordOfB"
priority = 2
}
This could be dangerous if you select an SSID which is not available the time you are going to change WiFi connection.
Code: Select all
#!/bin/bash
word=$(wpa_cli -i wlan0 status |grep -w "id")
id_num=${word:3:3}
if [[ $id_num == "1" ]]; then
wpa_cli -i wlan0 select_network 0
else
wpa_cli -i wlan0 select_network 1
fi
Code: Select all
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface <ssid1> inet static
address 192.168.1.18
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 192.168.1.254
iface <ssid2> inet static
address 10.10.10.18
netmask 255.255.255.0
gateway 10.10.10.254
dns-nameservers 10.10.10.254
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR
network={
ssid="ssid1"
psk="<my passwd>"
key_mgmt=WPA-PSK
priority=15
id_str=<ssid1>
}
network={
ssid="ssid2"
psk="<my passwd>"
key_mgmt=WPA-PSK
priority=1
id_str="<ssid2>"
}