2

I have a Raspberry Pi 3 which is using an external USB WiFi adapter. (ex: TL-WN722N). Therefore, the RPI3 has two wifi interfaces. (wlan0 (internal) and wlan1 (external))

I'm using Raspbian Stretch Lite (2017-09-07)

I would like my Raspberry Pi 3 to use two differents wpa_supplicant.conf files. That is one config file for wlan0 and one for wlan1.

However, I'm not sure where I must specify this information.

Do I have to change the /etc/network/interfaces file ?

Do I have to change the /etc/dhcpcd.conf file ?

I'm a bit confused because it seems the network configuration is changing on every release of Raspbian. I'm not sure /etc/network/interfaces must be use anymore since it contains nothing except comments on Raspbian Stretch

Would it be valid to use the following configuration: sudo cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant_wlan0.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant_wlan1.conf

Is it ok to add configuration in /etc/network/interfaces with Raspbian Stretch ?

3

To understand the recent changes to networking it helps to understand HOW and WHY they were made.

Stretch includes a 10-wpa_supplicant hook so it is no longer necessary to include it in intefaces.

Stretch introduces predictable network interface names which have been used in other distributions for some time. This means eth0 and wlan0 may not exist, and thus the older interfaces was no longer viable.

You should be able to use the older interfaces if you delete /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant and/or /usr/share/dhcpcd/hooks/10-wpa_supplicant (I have not tested this myself, and do not know why there are 2 instances, although I had manually installed myself in Wheezy.)

You should also also check whether you ACTUALLY have a wlan1, you can force Stretch to use the older scheme, but the newer scheme was introduced for a reason, particularly for those with multiple network cards.

See How to set up networking/WiFi for more background.

It may be possible to configure dhcpcd to use different wpa_supplicant.conf files, although I have never investigated this.

Examination of 10-wpa_supplicant shows it looks for files named wpa_supplicant-"$interface".conf, so you should be able to create interface specific files.

  • This is exactly it -- thanks. Preferable to other solutions I've come across, and clearly explained. – Stuart Hickinbottom Jan 8 at 21:34
  • Yeah! moving wpa_suppicant.conf to wpa_supplicant.conf works perfectly. – Hola Soy Edu Feliz Navidad Oct 12 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.