Use two wireless network interfaces on Raspberry Pi 3

Recently I have made some physical changes to my home network. Moved the WiFi router to a more central position to get better coverage, but that meant also my main media player running Xbian could no longer be connected via Ethernet cable, but had to switch to WLAN.

Well wireless adapter on Pi3 is ok for basic stuff, but it does not have good antenna to achieve better network quality or it could run at least 150Mbits which I required.

I remember I had couple of Realtek 300Mbit USB sticks bought long time ago that I was not using. Everything was OK when I switched from cable to WLAN1 (let’s call this my Realtek Card, WLAN0 is the built-in RPi3).

At that time my WLAN0 was disabled, since I was not using it by blacklisting the modules in /etc/modprobe.d/xbian.conf

alias char-major-89 i2c-dev

blacklist evbug
#blacklist brcmfmac
#blacklist brcmutil

As soon as I wanted to use both WLAN0 and WLAN1, my WLAN1 stopped working. Device was detected, module was loaded, but no wlan1 device was created.

I searched for such issue and found something similar with proposed fixes, so I tested it and surprisingly it works.

Main thing is the order of loading the kernel modules. Because if RPi3 built-in adapter loads first you will have an issue where wlan1 will not appear. You need to plug out / in the USB adapter to get it recognized or to remove and insert the kernel r8712u module.

Easiest way to fix the issue for me was to add these 3 lines to /etc/modules at the end of the file:

# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.


This meant that my Realtek card will get detected before the built in one and therefore it will have the wlan0 name and wlan1 will be rpi3 adapter.

Because your device names are also created in /etc/udev/rules.d/70-persistent-net.rules you need to make appropriate changes there to change built-in adapters name to wlan1 and USB adapter to wlan0:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# USB device 0x:0x (smsc95xx)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:04:64:20", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# Unknown net device (/devices/platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0) (brcmfmac_sdio)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:54:24:45", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

# USB device 0x:0x (r8712u)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:a1:b0:42:56:4c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Reboot and you should have both adapters working with external one as wlan0 and built-in one as wlan1.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.