How to Build a WiFi Extender from Scratch with a Raspberry Pi

Building your own WiFi extender from scratch with a Raspberry Pi is a fun DIY project that allows you to expand your home wireless network coverage. With just a few components, you can set up a Raspberry Pi as a wireless access point to boost your existing WiFi signal into hard-to-reach areas.

What You Will Need

To build a Raspberry Pi WiFi extender, you will need:

Optional items:

Setting Up the Raspberry Pi

Follow these steps to set up your Raspberry Pi:

Install Raspbian OS

  1. Download the latest Raspbian image from the Raspberry Pi website.
  2. Flash the image onto a microSD card using balenaEtcher.
  3. Insert the microSD card into the Pi.

Connect Hardware Peripherals

  1. Insert the WiFi adapter into a USB port. Use an adapter capable of access point mode.
  2. Connect the Pi to your router using an Ethernet cable. This will provide the backbone internet connection.
  3. Connect the USB power supply to the Pi.

Configure the Raspberry Pi

  1. From another device on your network, SSH into the Pi.
  2. Run sudo raspi-config to open the configuration tool.
  3. Change settings like hostname, password, locale, etc.
  4. Enable the SSH server under Interfacing Options.
  5. Reboot the Pi to apply changes.

Setting Up the WiFi Extender Software

With the Pi set up, it's time to configure the software:

Install Required Packages

Run the following commands to install the packages we need:

sudo apt update
sudo apt install hostapd dnsmasq

Configure the DHCP Server

Edit /etc/dnsmasq.conf and uncomment this line:

dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

This will allow the Pi to assign IP addresses to wireless clients.

Configure the Access Point Host Software

Edit /etc/hostapd/hostapd.conf and add the following:

interface=wlan0
driver=nl80211
ssid=NAME_OF_YOUR_EXTENDER
hw_mode=g
channel=7
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

Replace SSID and passphrase with your own. This configures hostapd with the extender network settings.

Configure the Wireless Interface

Edit /etc/network/interfaces and add:

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.4.1
netmask 255.255.255.0
network 192.168.4.0
broadcast 192.168.4.255

This sets the Pi's wireless interface IP address.

Configure Routing and NAT

Run these commands to enable routing and NAT between wlan0 and eth0:

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Save and Enable Services

  1. Save all config files.
  2. Run sudo systemctl unmask hostapd and sudo systemctl enable hostapd
  3. Reboot the Pi with sudo reboot

The WiFi extender should now be active! Connect wirelessly and test internet access.

Improving the WiFi Extender

Here are some optional steps to optimize performance:

With a Raspberry Pi, USB WiFi adapter, and the right software configuration, you can build an inexpensive, customizable WiFi range extender suitable for most homes and small offices. This project is a great way to tinker with hardware, learn about wireless networking, and improve your home network coverage.