I have a range extender on one side of the house but it gives out really poor signal and looks to be slowly dying.

I have a spare UniFi AP that I want to use but no Ethernet connection on that side of the house, so I want to make a Pi that connects to my WiFi and then I can plug the AP into the lan port on the pi.

I know you can do this using NAT and have a dhcp server on the lan port. But I want it to be a full passthrough almost like a bridge.

Can anyone help with this?

2 Answers 2


I did something similar. Now this isn't a bridge because it's using NAT, but you mentioned NAT so I think you really just want an AP Client Router.

You could also genuinely route across the Pi just by binding a network to each side and giving it a route to use (like a default) after enabling IP forwarding. But that tends to give people a harder time to do it this way because it's not very intuitive how it just "works".

If you just need to access something behind the Pi, you can set up port-forwards in the firewall. There's plenty of help out there to cover that.

I have a Pi connect to my apartment's wifi, then put it on a switch so my PCs can share it and see each other (the wifi has segregation turned on)

Now you need to put a static IP on the LAN side...

sudo /etc/dhcpcd.conf

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Now set up the DHCP server

sudo apt-get install isc-dhcp-server

sudo pico /etc/dhcp/dhcpd.conf

option domain-name "mydomain.com";
option domain-name-servers,;
default-lease-time 600;
max-lease-time 2400;
ddns-update-style none;
subnet netmask {
       option routers;
       option domain-name-servers,;

Now enable IP forwarding in the kernel

sudo pico /etc/sysctl.conf

Uncomment where it says net.ipv4.ip_forward=1 Now create the iptable rules to allow for NAT forwarding

sudo iptables -t nat -A  POSTROUTING -o wlan0 -j MASQUERADE
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Find exit 0 and put this above it in the rc.local file

sudo pico /etc/rc.local

iptables-restore < /etc/iptables.ipv4.nat

You can just join a network with the GUI to speed things along. It will keep connecting to that one over and over until it can't upon reboot. However to make things more robust and "correct"...

See what wireless networks are available you can type

sudo iwlist wlan0 scan | egrep "Quality|ESSID|Signal|Rates"

which will give you a shortened output of just SSIDs, signal strengths, channels, and such like below:

pi@raspberrypi:~ $ sudo iwlist wlan0 scan | egrep "Quality|ESSID|Signal|Rates"
                   Quality=39/70  Signal level=-71 dBm
                   ESSID:"Best Western Hotel"
                   Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
                   Quality=37/70  Signal level=-73 dBm
                   Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
                   Quality=50/70  Signal level=-60 dBm
                   ESSID:"My Home Network"
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                   Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s

Once you know which network you want to use, it's up to you to first get the formatting correct to add it to your configuration:

pi@raspberrypi:~ $ sudo wpa_passphrase "Best Western Hotel" "Room112passwd"

That will return something like this:

       ssid="Best Western Hotel"

Now you will want to cut and paste that output into your /etc/wpa_supplicant/wpa_supplicant.conf file. The first few lines are global configuration terms, the rest determine how to join various networks.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

       ssid="Coffeeshop Guest"
       ssid="Best Western Hotel"

The priority commands indicate what order the SSIDs should be attempted.

If I missed something, I'm sorry.. this was a good bit to do from memory... I think I got everything..


  • Ill give it a go and see what I end up with. Only problem I will have is if devices on my main lan want to communicate with any devices on the eth0 port of the Pi. Apr 3, 2020 at 18:42

The problem with a Raspberry Pi is, that it cannot bridge a client connection on interface wlan0 to a remote hotspot. This needs hardware support on the WiFi chip, which isn't available. But there is a workaround to emulate a real OSI layer 2 bridge using proxy arp. This is not a real bridge but it behave like one. How to setup it you can look at Workaround for a wifi bridge on a Raspberry Pi with proxy arp. Because you have a static environment you should follow section ♦ Static configuration of proxy arp. It is simpler to setup.

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.