3

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 ?

tlhIngan
  • 3,342
  • 5
  • 18
  • 33
ssinfod
  • 586
  • 2
  • 10
  • 19

1 Answers1

4

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.

Milliways
  • 54,718
  • 26
  • 92
  • 182