I'm trying to setup my pi as router. And the graph down below is what I want to be.

 ________              _____________________
|        |            |                wlan1| >)) lan ((< Other device like smart phone
|Another |            |       Raspberry     |
|router  |>)) wan ((< |wlan0  Pi 3B+    eth0| >--lan--< My PC
|________|            |_____________________|

But now I can only done either wlan0 to eth0 or wlan0 to wlan1. How can I let pi share wlan0 to both wlan1 and ent0 at the same time.

I use Edimax N150 usb wifi dongle as a wlan1.

  • should eth0/wlan1 be on the same subnet? If so, you could bridge et0/wlan1 - then it's easy since its now bridge -> wlan0 Commented Mar 1, 2021 at 9:24

1 Answer 1


Thanks for Jaromanda X's comment.
So first I reference to Setting up a Raspberry Pi as a bridged wireless access point bridging eth0 & wlan1 as br0.
Then setup wlan0 connection by edit /etc/wpa_supplicant/wpa_supplicant.conf and install dnsmasq by using sudo apt install dnsmasq. Modify /etc/dhcpcd.conf add following line below interface br0:

static ip_address=

After setting up dhcpcd.conf, we are now modifying /etc/dnsmasq.conf it's better to make a backup of the dnsmasq.conf. Now open up /etc/dnsmasq.conf add following lines:


Then enable ip_forwarding in /etc/sysctl.conf, find #net.ipv4.ip_forward=1 and remove # beginning of it.
To make ip_forward enable immediately run:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

Adding iptable rules:

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o br0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i br0 -o wlan0 -j ACCEPT

Then save rules:

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Appending new iptables rules in /etc/rc.local, so Pi will run it automatic every reboot. Open up /etc/rc.local appand iptables-restore < /etc/iptables.ipv4.nat above exit0.

Finally start dnsmasq service and reboot system by following commands:

sudo systemctl start dnsmasq.service
sudo reboot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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