GithubHelp home page GithubHelp logo

mrtejas99 / wifi-extender Goto Github PK

View Code? Open in Web Editor NEW
90.0 9.0 29.0 114 KB

A WiFi repeater built around Raspberry Pi under 10 US$

License: GNU General Public License v3.0

Python 31.75% CSS 30.13% HTML 5.64% Shell 32.47%
raspberry-pi raspberry-pi-zero-w wifi-repeater project network wifi

wifi-extender's Introduction

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 [email protected], 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 [email protected]

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 [email protected]

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:

wifi-extender's People

Contributors

mrtejas99 avatar thewh1teagle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wifi-extender's Issues

Can't get stable connexion on hotspot when wlan1 antenna is plugged

Hi!

The wifi connexion is "hopping" when the external antenna is plugged in. It's an Alfa antenna for long range wifi from my neighbors to my holiday home. (They gave me the password by the way, I did not crack any wifi !).
Any ideas on how to correct this ?

dmesg gives me some errors about brcmf with and without the external antenna plugged in.

"Hopping" means I get a connexion for 2-3 seconds then it disconnects and reconnects in the 5 next seconds. It does this a few times and then disconnect completely. I don't think it's an issue from this tutorial, but I don't know where else I could ask.

Enregistrement.de.l.ecran.2021-08-03.a.23.12.10.mov

The video is in real time.

Thanks for your help !

EDIT : the behavior is the same if I set my hotspot on wlan1 instead of wlan0

Access Point Clients

Is there a quick way to tell which clients are connecting through the Raspberry Pi AP extender?
I’m using this on a RPi Zero W and so far so good. Thanks for the code and tutorial.

whats need for masking the service ?

hello , can any one please tell me what is the need for masking the dhcpcd service...?
actually after masking the service everything works , but just the network icon disappears( i mean no apadter shown there ) from the raspberry os...

Not found interfaces

I think this is not a copy of another issue above.
(I am using Bash script)
I have done everything as I should, installed drivers from install-wifi and the problem still occurs.
My wifi dongle is Tp-Link TL WN823N RTL8192EU (output from lsusb). When I use iwconfig it displays 3 wlans: wlan0 and wlan2 connected to my starting wifi network and wlan1 not connected to anything and without name (unassociated EESID:"")
Edit: I am using RPi Zero W here

Connect Issue

When i try to connect. this msg coming,
TypeError: The view function for 'repeaterConf' did not return a valid response. The function either returned None or ended without a return statement.

Isolated AP network

I would like to make the AP network of the raspberry pi fully isolated from the network which the internet comes from.
Does it's possible?

Cannot access the admin interface of my router

After running the installation script in a pristine setup, the wifi extension works fine, but I cannot access the admin interface of my router (the one I'm extending), at http://192.168.1.1/. I can ping the address, but the browser "can’t establish a connection to the server at 192.168.1.1."

pi@raspberrypi:~ $ ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.110  netmask 255.255.255.0  broadcast 192.168.1.255
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.27  netmask 255.255.255.0  broadcast 192.168.1.255

Yes, I changed the wlan0 address to 192.168.1.110, for compatibility with my previous setup.

This is from a connected computer:

$ traceroute www.cnn.com
traceroute to www.cnn.com (151.101.193.67), 30 hops max, 60 byte packets
 1  _gateway (192.168.1.110)  3.290 ms  8.929 ms  27.262 ms
 2  192.168.1.1 (192.168.1.1)  27.517 ms  28.298 ms  31.988 ms
 3  * * *
 [...]

doesn't work

I've followed all steps but isn't working, the new wifi isn't visible.

DNS hardcoded to 1.1.1.1

It seems that the instructions and the setup script hardcode the DNS to go via 1.1.1.1 (Cloudflare).

/etc/systemd/network/08-wlan0.network:

[DHCPServer]
DNS=1.1.1.1

It think it would be better to hand the DNS requests to the router, which may know local addresses that Cloudflare does not know of.

New Automatic script!

I found that the configurations steps are very grueling, So i decided to create a bash script that will config the whole stuffs automatically

I tested it on a fresh install of Raspbian Lite and it worked immediately after I ran the script!
That means you can create a wifi extender from your raspberry pi in something like 2 minutes and one command.

wifi_extender.bash

Access point will not authenicate

I have followed your instruction as decribed in github. I can see the new access point on wlan0 with its ip address and can also see an ip address on wlan1with dhcp ip fro my router. When I try to connect to the access point, the authentication fails. I have tried chaning the password, but still not success in connecting to the acccess point. I would appreaciate any help were possible?

Raspberry Pi OS (not lite) - No internet until browsing a page

Interesting issue on Raspberry Pi OS, not lite or full, but with desktop. New AP comes up just fine, I can connect, but I get a report of no internet access until I browse any page on Chromium in the RPi OS. It's almost like the wlan1 is/goes asleep or something because I will lose internet access if I haven't done anything on the RPi in a few minutes. Running a ping to something like 1.1.1.1 or 8.8.8.8 seems to keep alive the connection.

Any thoughts (other than redoing everything with RPi Lite, really don't feel like rebuilding the drivers and all that fun again...)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.