Introduction: Truly WiFi Extender

Introduction

Truly WiFi Extender is a WiFi repeater based on Raspberry Pi Zero W. It makes a nice alternative to a commercial WiFi repeater combining low-cost (under 10USD) and highly customizable software. It can also run some ad-blocking solutions such as pi- hole as well. This project is one of a kind because most of the projects on GitHub demonstrate how to create a wireless AP to share Internet access obtained using Ethernet.

View my project on Hackaday Hackaday
View my project on GitHub Github
View my project on Hackster Hackster

Step 1: Prerequisites

For flashing the image onto the SD card I have used BalenaEtcher

  • Download the raspbian lite.iso file from the Raspberry Pi website
  • Once downloaded, open BalenaEtcher, select the .iso file, select the SD card and click the flash button and wait for the process to finish.
  • Then, open the boot partition and inside it, create a blank text file named ssh with no extension.
  • Finally, create another text file called wpa_supplicant.conf in the same boot partition and paste the following content.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev<br>update_config=1
country=IN
network={
ssid="mywifissid"
psk="mywifipassword"
key_mgmt=WPA-PSK
}

Replace the mywifissid with the name of the WiFi and mywifipassword with the wifi password

  • Power on the Raspberry pi. To find its IP, you can use a tool like Angry IP Scanner and scan the subnet
  • Once you find the IP, SSH to your Pi using a tool like PuTTY or just ssh pi@raspberrypi.local, enter the password raspberry and you are good to go
  • Finally, update the package list and upgrade the packages and reboot Pi.
sudo apt update -y
sudo apt upgrade -y
sudo reboot

Step 2: Setting Up Systemd-networkd

From ArchWiki

systemd-networkd is a system daemon that manages network configurations. It detects and configures network devices as they appear; it can also create virtual network devices.

To minimize the need for additional packages,networkd is used since it is already built into the init system, therefore, no need for dhcpcd.

  • Prevent the use of dhcpd

Note: It is required to run as root

sudo systemctl mask networking.service dhcpcd.service
sudo mv /etc/network/interfaces /etc/network/interfaces~
sed -i '1i resolvconf=NO' /etc/resolvconf.conf 
  • Use the inbuilt systemd-networkd
sudo systemctl enable systemd-networkd.service systemd-resolved.service
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Step 3: Configuring Wpa-supplicant

wlan0 as AP

  • Create a new file using the command.
sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf 
  • Add the following content and save the file by pressing Ctrl X, Y and Enter
country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="TestAP-plus"
mode=2
key_mgmt=WPA-PSK
psk="12345678"
frequency=2412
}

Replace the TestAP-plus and 12345678 with your desired values.

This configuration file is to be used for the onboard wifi Adapter wlan0 which will be used to create a wireless access point.

  • Give the user read, write permissions to the file
sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf 
  • Restart wpa_supplicant service
sudo systemctl disable wpa_supplicant.service
sudo systemctl enable wpa_supplicant@wlan0.service

Step 4:

wlan1 as client

  • Create a new file using the command.
sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan1.conf 
  • Add the following content and save the file by pressing Ctrl X, Y and Enter
country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Asus RT-AC5300"
psk="12345678"
}

Replace the Asus RT-AC5300 and 12345678 with your Router SSID and password.

This configuration file is to be used for the USB WiFi Adapter wlan01 which will be used to connect to a Wireless Router.

  • Give the user read, write permissions to the file
sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan1.conf 
  • Restart wpa_supplicant service
sudo systemctl disable wpa_supplicant.service
sudo systemctl enable wpa_supplicant@wlan1.service

Step 5: Configuring Interfaces

  • Create a new file using the command.
sudo nano /etc/systemd/network/08-wlan0.network
  • Add the following content and save the file by pressing Ctrl X, Y and Enter
[Match]
Name=wlan0
[Network]
Address=192.168.7.1/24
IPMasquerade=yes
IPForward=yes
DHCPServer=yes
[DHCPServer]
DNS=1.1.1.1 
  • Create a new file using the command
sudo nano /etc/systemd/network/12-wlan1.network 
  • Add the following content and save the file by pressing Ctrl X, Y and Enter
[Match]
Name=wlan1
[Network]
DHCP=yes 
  • Reboot the Raspberry Pi using
sudo reboot