Having weak WiFi signal in parts of your home or office can be frustrating. While you can buy commercial range extenders, making your own DIY WiFi extender with a Raspberry Pi is a fun weekend project that can save you money.
In this guide, I'll walk you through the entire process of building a Raspberry Pi WiFi extender step-by-step. With just a little bit of tinkering, you can build an extender that will significantly boost your wireless signal to eliminate dead zones.
What You'll Need
To build your Raspberry Pi WiFi extender, you'll need:
- A Raspberry Pi (any model will work, I used a Raspberry Pi 3 Model B)
- A microSD card (I recommend at least 16GB)
- A power supply for the Pi
- A case for the Pi (optional)
- A USB WiFi adapter that supports AP/monitor mode
Important: Make sure to get a USB WiFi adapter that is compatible with AP mode, or this project won't work. I used the TP-Link N300 adapter which works perfectly.
Setting Up Raspberry Pi
The first step is to get your Raspberry Pi up and running. Here's what you need to do:
-
Install Raspbian on the microSD card. Download the latest Raspbian image and use Etcher to burn it onto the microSD card.
-
Insert the microSD card into the Pi and connect the Pi to your monitor, keyboard, and mouse. Apply power to boot it up.
-
Once booted, run
sudo raspi-config
to change settings like WiFi country, password, enable SSH, etc. -
Update the OS packages by running
sudo apt update && sudo apt full-upgrade
. Reboot. -
If using WiFi, connect your Pi to the wireless network it will extend.
With basic setup complete, you're ready to install the software to turn your Pi into a WiFi extender.
Installing WiFi Extender Software
Several different programs can turn a Raspberry Pi into a WiFi extender. I recommend using Hostapd and DNSMasq. Follow these steps to install them:
-
Run
sudo apt install dnsmasq hostapd
. Enter your password when prompted. -
Configure DNSMasq by editing
/etc/dnsmasq.conf
. Uncommentinterface=wlan0
anddhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
. -
Create a new file
sudo nano /etc/dnsmasq.d/repeat-wlan0
and addinterface=wlan0
anddhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
. -
Configure Hostapd by editing
/etc/hostapd/hostapd.conf
:
interface=wlan0
driver=nl80211
ssid=NAME_OF_NEW_NETWORK
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Be sure to update ssid, channel, and wpa_passphrase.
- Finally, edit
/etc/default/hostapd
and setDAEMON_CONF
to/etc/hostapd/hostapd.conf
.
That configures the required software. Now the Pi just needs to be set to route traffic between the WiFi networks.
Enabling Internet Connection Sharing
To connect your new WiFi network to the Internet, the Raspberry Pi needs to pass data between its WiFi chip and USB WiFi adapter. Here's how to enable routing:
-
Edit
/etc/sysctl.conf
and uncommentnet.ipv4.ip_forward=1
to enable IP forwarding. -
Add a iptables rule with
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
-
Save the iptables rule:
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
-
Edit
/etc/rc.local
to load iptables on boot:
```
!/bin/sh -e
rc.local
Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
Load iptables rules
iptables-restore < /etc/iptables.ipv4.nat
exit 0
```
That's it! Now we just need to bring up our new wireless network.
Starting Your DIY Extender
To start your Raspberry Pi WiFi extender, you just need to start hostapd and DNSMasq:
-
Reboot your Pi -
sudo reboot
-
Bring up your new wireless interface -
sudo ifconfig wlan0 up
-
Start hostapd -
sudo systemctl start hostapd
-
Start DNSMasq -
sudo systemctl start dnsmasq
After a minute or two, you should see your new network show up when you search for WiFi! Connect to it and verify you have Internet access.
Enjoy your DIY WiFi extender! Let me know in the comments if you have any trouble getting it working.