Skip to main content
3 of 3
Commonmark migration

2 Wifi NIC's that each only connect to one (different from each other) network

The Setup:

  • Raspberry Pi 3 B (Raspbian GNU/Linux 9 (stretch)) and boots to Command Line
  • (internal Wifi NIC) [wlan0]
  • additional external Wifi NIC [wlan1]

What I want to achieve:

I Have two different wireless networks: One is always available (a), the other one not (b). I want to configure the networking in a way, that:

wlan0 -> a
wlan1 -> b

and the following happens but should not:

wlan0 -> a
wlan1 -> a
----or----
wlan0 -> b
wlan1 -> b

How do I avoid this?

What have i done so far?

Try1 (wpa_supplicant.conf & /etc/network/interfaces)

pi@raspi:~ $ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE

network={
        ssid="HomeNetwork"
        psk="############"
        id_str="home"
}

network={
        ssid="MobileNetwork"
        psk="############"
        id_str="mobile"
}
pi@raspi:~ $ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

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

iface mobile inet dhcp

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

iface home inet dhcp

Try2

I've booted to Desktop and connected the interfaces to the according network and rebooted to Command Line...