How to configure wpa_supplicant configuration to handle multiple USB WIiFi devices with single wpa_supplicant configuration file with system
by chetuneve from LinuxQuestions.org on (#5AG54)
I'm using systemd-networkd for network configurations, which has made networking setup a lot easier for wired and wifi interfaces. But not in case of wpa_supplicant configurations. I would like to make it just as easy for WiFi interfaces configurations with wpa_supplicant configuration, but it seems there's some kind of wildcard support missing for wpa_supplicant.
Here's my /etc/systemd/network/wifi.network:
[Match]
Name=wl*
[Network]
DHCP=yes
In addition, I'm running:
systemctl enable wpa_supplicant@wlp0s20f3
systemctl start wpa_supplicant@wlp0s20f3
because that's the interface that my current WiFi USB adapter comes up on. This goes with /etc/wpa_supplicant/wpa_supplicant-wlp0s20f3.conf:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="NETWORK_NAME"
psk=621cc1aea8fc104d2988843a3af634014bdabcc30dd4a3a62f2809dccdbd6ea7
key_mgmt=WPA-PSK
priority=1
}
This all works fine, except that:
In case If I changed my USB WiFi Adapter then the interface name of newly attached USB WiFi device may be different and wpa_supplicant isn't running there with the desired interface name like following:
wpa_supplicant@<interface_name>
systemd-networkd solved that problem nicely with the wildcard in the interface name above (Name=wl*)
But I am looking something similar kind of trick for all of the wireless interfaces to be configured with single wpa_supplicant configuration file.
My question is can I do something similar with wpa_supplicant, so I don't have to run a separate wpa_supplicant daemon on all possible interface names?
Thank you so much in advance for your help.


Here's my /etc/systemd/network/wifi.network:
[Match]
Name=wl*
[Network]
DHCP=yes
In addition, I'm running:
systemctl enable wpa_supplicant@wlp0s20f3
systemctl start wpa_supplicant@wlp0s20f3
because that's the interface that my current WiFi USB adapter comes up on. This goes with /etc/wpa_supplicant/wpa_supplicant-wlp0s20f3.conf:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="NETWORK_NAME"
psk=621cc1aea8fc104d2988843a3af634014bdabcc30dd4a3a62f2809dccdbd6ea7
key_mgmt=WPA-PSK
priority=1
}
This all works fine, except that:
In case If I changed my USB WiFi Adapter then the interface name of newly attached USB WiFi device may be different and wpa_supplicant isn't running there with the desired interface name like following:
wpa_supplicant@<interface_name>
systemd-networkd solved that problem nicely with the wildcard in the interface name above (Name=wl*)
But I am looking something similar kind of trick for all of the wireless interfaces to be configured with single wpa_supplicant configuration file.
My question is can I do something similar with wpa_supplicant, so I don't have to run a separate wpa_supplicant daemon on all possible interface names?
Thank you so much in advance for your help.