wpa_supplicant for dual WLAN

2

1

I've got wlan0 and wlan1. Each interface should connect to a different SSID.

I would like to use wpa_supplicant for both.

I can put the two networks in /etc/wpa_supplicant.conf, but how do I tell which one each interface should use?

(RHEL 6.3)

user1219721

Posted 2012-09-01T19:10:54.317

Reputation: 273

Answers

5

You create two separate wpa_supplicant.conf files, one for each interface. Then you specify which conf file goes with which interface when you invoke wpa_supplicant. You use the -N option to show that you want to start describing a new interface.

This example comes right out of the wpa_supplicant(8) man page:

wpa_supplicant \
    -c wpa1.conf -i wlan0 -D hostap -N \
    -c wpa2.conf -i ath0 -D madwifi

Spiff

Posted 2012-09-01T19:10:54.317

Reputation: 84 656

Thanks. This works in my NixOS – typelogic – 2019-09-20T02:15:36.623

How would you use this if wpa_supplicant is being ls being run as a service e.g. via systemd? – alexpotato – 2020-02-25T12:25:35.257

0

You will need to create two new files in the following directory: /etc/wpa_supplicant/

The new files should be named with the interface name i.e wpa_supplicant-wlan1.conf

You should end up with two files like so:

for interface wlan0:

  • file /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

for interface wlan1:

  • file /etc/wpa_supplicant/wpa_supplicant-wlan1.conf

content of wpa_supplicant-wlan0.conf file

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

country=US

network={
        ssid="ssid0"
        psk="pass0"
}

content of wpa_supplicant-wlan1.conf file

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

country=US

network={
        ssid="ssid1"
        psk="pass1"
}

reboot PI and you should have SSID attached to an interface.

junaid

Posted 2012-09-01T19:10:54.317

Reputation: 11

This was originally downvoted but it worked for me. – alexpotato – 2020-02-26T22:06:44.907