Working with a number of WiFi interfaces on a Raspberry Pi

Typically I like to hook up with a number of WiFi networks on my Pi for... causes.

Different instances I like with the ability to use a greater wi-fi interface than the built-in WiFi module on the Pi 4 or CM4, however do not need to add dtoverlay=disable-wifi in my /boot/config.txt and reboot.

Since Pi OS makes use of wpa_supplicant, it is really simple to do that.

First, see what interfaces you may have accessible, e.g. with ip a:

$ ip a
...
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    hyperlink/ether e4:5f:01:4e:f0:22 brd ff:ff:ff:ff:ff:ff
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    hyperlink/ether 84:5c:f3:f6:e9:29 brd ff:ff:ff:ff:ff:ff

If you wish to specify a community configuration that solely applies to wlan1, create a file named /and so on/wpa_supplicant/wpa_supplicant-wlan1.conf, and put your community credentials inside:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
nation=US

community={
    ssid="my-network-name"
    psk="my-network-password"
}

Clearly, substitute your personal values the place related.

It ought to attempt connecting on wlan1 routinely (it is best to have the ability to comply with with dmesg --follow), however typically, for some unusual motive, it will not, and you will have to reboot the Pi to choose up the modifications.

The logic for the naming of wpa_supplicant.conf recordsdata is situated inside /usr/share/dhcpcd/hooks/10-wpa_supplicant. And if it's essential manually deliver down an interface, run sudo ifconfig wlan0 down. You may also attempt reloading the wpa_supplicant config manually with sudo wpa_cli -i wlan0 reconfigure, however typically that does not appear to work for me.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *