Dual Band Access Point Using Raspberry Pi

Jerameel Delos Reyes
5 min readNov 28, 2020

How to use Raspberry Pi 3B+/4 as a Dual Band Wireless Access Point.

There’s a lot of tutorials in the internet on how to setup raspberry pi as a wireless access point, but I haven’t seen anything about using it as a dual band.


  • A Raspberry Pi 3B+ or 4
  • You know the basics of Rasberry Pi and you have Raspbian installed.
  • USB WiFi Dongle N ( I used TP-Link TL-WN725N V3)
  • An Existing LAN connection

Raspberry Pi 3B+ or 4 supports both 2.4 and 5 GHz but it does not allow using both bands simultaneously. We’ll be using the built in 5 GHz(A/C) and a USB WiFi dongle for 2.5Ghz(N) support.

Also make sure that the USB WiFi Dongle you are using is compatible with Raspberry Pi, in my case i had to setup my dongle using these drivers.

Interface Naming

On Raspberry Pi, we can access the interfaces by executing iwconfig. In normal situations that there’s nothing plugged in with the device, we should be able to see eth0 and wlan0 with the same hardware address (MAC) every time. But this behavior changes when we start to plugin the USB WiFi Dongle. We need to setup the interface names to be static so that they would not change when we reboot the raspberry pi.

Disable Predictable Names

Ironically, this feature makes it more unpredictable that it should be. We need to make sure it’s disabled on raspberry pi config.

  1. sudo raspi-config
  2. Choose Network Options
  3. Select N3 Network interface names
  4. Disable Predicable Names

Manual Interface Naming Rules

Once predictable naming is disabled, we now need to create a mapping for the interface names and their corresponding hardware address. To do this, we need to create a rule by running:

sudo nano /etc/udev/rules.d/70-persistent-net.rules

Add these entries and make sure you update the address values.

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:00:00:00:00:00", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:00:00:00:00:00", NAME="wlan1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:00:00:00:00:00", NAME="wlan0"

You can get the address values by executing ifconfig. Also note, that in this tutorial we use wlan1 for the USB WiFi Dongle.

Example address value for wlan0

Setting Up the Access Point

Now we’ve setup our network interfaces, we can now proceed on setting up our access point and networking.


There’s a couple of packages we need to install. I’ll summarize what each package does, but feel free to check their full documentation.

hostapd — handles running the actual access point and its configurations like SSID and password.

dnsmasq — for handling DNS and DHCP

netfilter-persistent/iptables-persistent — for making firewall rules persistant even when we reboot.

sudo apt install hostapdsudo apt install dnsmasqsudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent

Interface, Routing, and Firewall Configuration

Edit the dhcpd configuration file:

sudo nano /etc/dhcpcd.conf

At the end of the file, add the following then save:

interface wlan1
static ip_address=
nohook wpa_supplicant
interface wlan0
static ip_address=
nohook wpa_supplicant

We also need to enable routing and IP masquerading, this allows wireless clients to access the internet. To begin, let’s create another file with this command:

sudo nano /etc/sysctl.d/routed-ap.conf

Add the following content then save:

# https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
# Enable IPv4 routing

And for the firewall rules, we need to execute:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo netfilter-persistent save

DHCP and DNS Configuration

As for the dhcp rules, rename the default configuration file for backup and edit a new one:

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf

Add the following content, then save:


In this case for wlan1 its range– is equal to 9 wireless devices with a lease time of 24 hours. You can adjust these values based on what you need.

Access Point Configuration

This is the last step, we’ll need to edit hostapd’s config file by running:

sudo nano /etc/hostapd/hostapd.conf

Add the following configuration then save:

# the interface used by the AP
# "g" simply means 2.4GHz band
# the channel to use
# limit the frequencies used to those allowed in the country
# the country code
# 802.11n support
# QoS support, also required for full speed on 802.11n/ac/ax
# the name of the AP
# 1=wpa, 2=wep, 3=both
# WPA2 only

But that’s only for 2.4 GHz, we’ll need to create another configuration for our 5 GHz Access Point, create a new config by executing:

sudo nano /etc/hostapd/hostapd-5g.conf

Add the following configuration and save, notice the difference from the first configuration.

# the interface used by the AP
# "a" simply means 5GHz band
# the channel to use
# limit the frequencies used to those allowed in the country
# the country code
# 802.11ac support
# QoS support, also required for full speed on 802.11n/ac/ax
# the name of the AP
# 1=wpa, 2=wep, 3=both
# WPA2 only

Make sure you update the wpa_passphrase and ssid for both config.

country_code is set to US to support 5GHz.

By default, hostapd only runs the first configuration. So we’ll need to override it’s service config, we do this by:

sudo cp /lib/systemd/system/hostapd.service /etc/systemd/system/hostapd.service

Then edit the file:

sudo nano /etc/systemd/system/hostapd.service

Update it with the following changes then save:

Description=Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
#ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}
ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS /etc/hostapd/hostapd.conf /etc/hostapd/hostapd-5g.conf

Lastly edit the hostapd environment file:

sudo nano /etc/default/hostapd

Comment some lines, makes sure it looks like this:

# Location of hostapd configuration file
# Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
DAEMON_OPTS=" -f /tmp/hostapd.log"

Now if you reboot your Raspberry Pi, the newly created 2.4GHz and 5GHz access points should appear in your wireless devices with the SSID and Password similar to the one you setup.