/wifi-extender

A WiFi repeater built around Raspberry Pi under 10 US$

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Truly WiFi Extender

Graphical Visualisation

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.

Hardware

This will run on any version of Raspberry Pi. But make sure to have two wifi adapters. Nowadays, Raspberry Pi comes with onboard WiFi. In case you have an older version, you might have to use two USB WiFi adapters. I will be using a single USB WiFi adapter since I am using Raspberry Pi Zero W.

Software

For this project, I will be using Raspbian Stretch Lite. You can download it on the official Raspberry Pi website. You can use the newer version of Raspbian as well.

The main packages on which this project is wpa_supplicant. Since Raspbian is Linux based and uses wpa_supplicant to manage WiFi cards, we can easily set up this computer as a WiFi access point. You even don’t need hostapd - just wpa_supplicant and systemd-networkd

View my project on Hackaday Hackaday
View my project on Instructables Instructables
View my project on Hackster Hackster

Video tutorials

Additional Features

  • If you want to check how to set up a web UI to take SSID and Password from the user, check this webUI
  • If you want to check how to set up WiFi extender by simply running a script(THE EASY WAY), check this page Script

Implementation

Prerequisites

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

  1. Download the raspbian lite.iso file from the Raspberry Pi website
  2. Once downloaded, open BalenaEtcher, select the .iso file, select the SD card and click the flash button and wait for the process to finish.
  3. Then, open the boot partition and inside it, create a blank text file named ssh with no extension.
  4. 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
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.
5. Power on the Raspberry pi. To find its IP, you can use a tool like Angry IP Scanner and scan the subnet,
6. 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.
5. Finally, update the package list and upgrade the packages and reboot Pi.

sudo apt update -y
sudo apt upgrade -y
sudo reboot

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.

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

Configuring wpa-supplicant

wlan0 as AP

  1. Create a new file using the command.
sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  1. Add the following content and save the file by pressing CtrlX, Yand 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.

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

wlan1 as client

  1. Create a new file using the command.
sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan1.conf
  1. Add the following content and save the file by pressing CtrlX, Yand 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.

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

Configuring Interfaces

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

References: