Working with multiple WiFi interfaces on a Raspberry Pi

Sometimes I like to connect to multiple WiFi networks on my Pi for... reasons.

Other times I like being able to use a better wireless interface than the built-in WiFi module on the Pi 4 or CM4, but don't want to add dtoverlay=disable-wifi in my /boot/config.txt and reboot.

Since Pi OS uses wpa_supplicant, it's actually easy to do this.

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

$ ip a
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/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
    link/ether 84:5c:f3:f6:e9:29 brd ff:ff:ff:ff:ff:ff

If you want to specify a network configuration that only applies to wlan1, create a file named /etc/wpa_supplicant/wpa_supplicant-wlan1.conf, and put your network credentials inside: