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:

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:

  1. Install Raspbian on the microSD card. Download the latest Raspbian image and use Etcher to burn it onto the microSD card.

  2. Insert the microSD card into the Pi and connect the Pi to your monitor, keyboard, and mouse. Apply power to boot it up.

  3. Once booted, run sudo raspi-config to change settings like WiFi country, password, enable SSH, etc.

  4. Update the OS packages by running sudo apt update && sudo apt full-upgrade. Reboot.

  5. 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:

  1. Run sudo apt install dnsmasq hostapd. Enter your password when prompted.

  2. Configure DNSMasq by editing /etc/dnsmasq.conf. Uncomment interface=wlan0 and dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h.

  3. Create a new file sudo nano /etc/dnsmasq.d/repeat-wlan0 and add interface=wlan0 and dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h.

  4. 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.

  1. Finally, edit /etc/default/hostapd and set DAEMON_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:

  1. Edit /etc/sysctl.conf and uncomment net.ipv4.ip_forward=1 to enable IP forwarding.

  2. Add a iptables rule with sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

  3. Save the iptables rule: sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

  4. 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:

  1. Reboot your Pi - sudo reboot

  2. Bring up your new wireless interface - sudo ifconfig wlan0 up

  3. Start hostapd - sudo systemctl start hostapd

  4. 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.