How to Turn Your Raspberry Pi into a Wi-Fi Bridge

Raspberry Pi Wifi Bridge Ethernet

Today, it’s tempting to assume every device supports Wi-Fi, but not all devices are capable of connecting to the Internet wirelessly. This is where a Raspberry Pi can come in handy: by turning it into a Wi-Fi bridge.

If you want to repurpose an old, Ethernet-only desktop computer and need a quick and easy way to convert a Wi-Fi signal into an Ethernet connection, you can use a Raspberry Pi.

Turn your Raspberry Pi into a Wi-Fi bridge

In this tutorial you’ll learn how to transform your Raspberry Pi into a Wi-Fi bridge that connects to your network wirelessly and converts this signal into a wired connection. You can then attach any device to the Raspberry Pi via an Ethernet cable, and that device will instantly have access to your network.

Your Raspberry Pi bridge can convert a Wi-Fi connection, into an ethernet connection.

Before going further, it’s worth noting that a device that’s connected to Wi-Fi via your Raspberry Pi is unlikely to enjoy the same speeds as a device that’s connected to your network directly. However, if it’s not possible to physically connect your Ethernet-only device to your router, then a Raspberry Pi is a quick, easy and relatively inexpensive way to get that device online.

What you’ll need

To complete this tutorial, you’ll need:

Update your Pi

If you haven’t already, attach your external keyboard, monitor, and any other peripherals to your Raspberry Pi, then attach your Pi to a power source.

Before you begin, check that your Raspberry Pi is up to date. Open a new Terminal by clicking the “Terminal” icon in Raspbian’s toolbar, then run the following commands:

sudo apt update && sudo apt -y upgrade

Set up your network services: installing dnsmasq

Next, install dnsmasq, which provides Domain Name System (DNS) caching and a Dynamic Host Configuration Protocol (DHCP) server. Use this package to process DNS requests, which will allow your Raspberry Pi to act as a mini-router for an Ethernet-only device.

To install dnsmasq, run the following command:

sudo apt install dnsmasq

Configure your ethernet connection

Next, set up the eth0 interface to use a static IP address by modifying the “dhcpcd.conf” file. To open this configuration file, run the following command:

sudo nano /etc/dhcpcd.conf

The “dhcpcd.conf” file will now open in the Nano text editor. In this file, add the following:

interface eth0
static ip_address=
static routers=

Save your changes by pressing Ctrl + O. To close the configuration file, press Ctrl + X.

These changes can be live by restarting the dhcpcd service:

sudo service dhcpcd restart

Replacing the dnsmasq configuration file

The dnsmasq package provides a default configuration file, but you need to replace this with your own custom settings that tell dnsmasq how to handle DHCP and DNS traffic.

Before making any changes, rename and relocate the original dnsmasq.conf file:

sudo nano /etc/dnsmasq.conf /etc/dnsmasq.conf.original

Open the replacement configuration file for editing:

sudo nano /etc/dnsmasq.conf

You should now be looking at the dnsmasq.conf file in the Nano text editor. In Nano, add the following:

You can use the Nano text editor to create a custom dnsmasq.conf file.

Save your changes, by pressing Ctrl + O. To close the configuration file, press Ctrl + X.

Enable IP forwarding

Next, enable IP forwarding so that your Raspberry Pi can accept network packets from the Ethernet connection and forward them to your router.

To enable ipv4p IP forwarding, edit the “sysctl.conf” configuration file:

sudo nano /etc/sysctl.conf

The “sysctl.conf” file will now launch in the Nano text editor. In this file, find the following line:


Remove the # so that this line becomes:

Setup port forwarding on your Raspberry Pi.

Save your changes by pressing Ctrl + O. To close the configuration file, press Ctrl + X.

Now, bring your new “sysctl.conf” configuration file into effect:

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

Start forwarding traffic from Ethernet to Wi-Fi

Now that you have successfully enabled IP forwarding, you can configure your firewall to forward traffic from the Ethernet interface (eth0) to the Wi-Fi connection. With this forwarding in place, any device that connects to the Raspberry Pi over Ethernet will gain access to the Pi’s Wi-Fi (wlan0) connection.

Add some rules that tell how your Raspberry Pi how to forward all the data packets that it receives:

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

Save these new rules:

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

These rules will get flushed every time your Raspberry Pi reboots, so make sure they’re reloaded at startup.

Define what happens at startup by editing the “rc.local” file:

sudo nano /etc/rc.local

The rc.local file will now open in the Nano text editor. In the editor, find the following:

exit 0

Add the following directly above the “exit” line:

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

Save your changes by pressing Ctrl + O. To close the configuration file, press Ctrl + X.ter.”

Test your Wi-Fi bridge

The final step is starting the dnsmasq service:

sudo service dnsmasq start

You can now put your Wi-Fi bridge to the test! Attach any Ethernet-only device to your Raspberry Pi via an Ethernet cable. Your Raspberry Pi will now provide an Internet connection to this Ethernet-only device.


You have learned how to share your Raspberry Pi’s Wi-Fi with any wired device by converting its Wi-Fi connection into an Ethernet connection. You can also use your Raspberry Pi as a Captive Portal Wi-Fi hotspot or as a personal web server. Let us know if this is useful to you.

Read on for other Raspberry Pi projects you can do on your own.

Jessica Thornsby
Jessica Thornsby

Jessica Thornsby is a technical writer based in Derbyshire, UK. When she isn’t obsessing over all things tech, she enjoys researching her family tree, and spending far too much time with her house rabbits.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox