Raspberry 3 – create a wifi repeater with USB wifi dongle
Updated on 2019 Jan 11 – tested and working from scratch
What you need to do this :
You need a raspberry pi 3 or raspberry pi 3 B+ if you want to handle wifi 5Ghz.
We need an extra wifi adapter (panda 005 or canakit wifi or any kernel supported adapter) – listed below are 2.4Ghz only
https://www.amazon.ca/gp/product/B00EQT0YK2/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
https://www.amazon.ca/CanaKit-Raspberry-Wireless-Adapter-Dongle/dp/B00GFAN498/ref=sr_1_4?s=electronics&ie=UTF8&qid=1546365634&sr=1-4&keywords=raspberry+pi+wifi
or that
https://www.canakit.com/raspberry-pi-wifi.html
What you need to do then
Deploy original raspbian lite on it (this is a network management device, we don’t want or need a GUI on it). SSH to it or connect on the raspberri pi itself. User pi, password raspberry, sudo bash to be root.
Update the system and install requirements as follow :
apt-get update
apt upgrade
apt-get update
apt-get install git bash util-linux procps hostapd iproute2 iw haveged dnsmasq iptables vim
git clone https://github.com/oblique/create_ap
cd create_ap/
make install
cd ..
The above does apply all the latest updates, and clone the create_ap script that allows easy wifi access point creation.
You might want to change keyboard layout, which by default is UK. I do use US layout, so to change, run « raspi-config » -> « 4 – Localisation Options » -> « I3 – change keyboard layout » -> »Generic 103… » -> « Other » -> « English (US) » -> « ok » -> « default » -> « ok » -> « no compose key » -> « ok » -> « finish »
(use TAB to switch between buttons)
We want to handle wpa_supplicant manually, because otherwise we can’t assign proper interface. There is a configuration menu on the raspi-config command, but this is NOT what we want. The default wpa_supplicant use any of the wifi adapters to connect, sometime both. But in our case, we want 1 connected, and 1 access point.
mv /etc/wpa_supplicant/wpa_supplicant.conf /home/pi/wpa_supplicant.conf
Content of wpa_supplicant.conf have to be :
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="yourexistingwifi"
psk="existingwifipassword"
}
In the above, you have to put the SSID of your main / existing wifi, and the password of it as psk. This will allow the raspberry to connect to this network with 1 of its adapters.
We then create a little script that will do what wee need. Create the file /home/pi/start-relaywifi.sh with the following content :
#!/bin/bash
wpa_supplicant -B -c/home/pi/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
create_ap -g 172.20.0.1 -c 10 -w 2 wlan1 wlan0 relaywifi relaywifipassword
The above use the wlan0 interface to connect to your existing wifi (using most likely the onboard wifi of the raspberry), and the second line create an access point on the second wifi adapter (the USB one) that shares the connection of the first one.
We then set this to be called at boot from /etc/rc.local by adding the following lines before the last line of rc.local :
/home/pi/start-relaywifi.sh
We then set the executable bit on our little script :
chmod +x /home/pi/start-relaywifi.sh
All good. Reboot the pi, and it should :
Boot raspbian, execute rc.local which call our script, connect to existing wifi, and appear as access point.
Sidenote : The onboard wifi driver does not support full A/P or bridging mode. Therefore, the extended wifi is using its own IP range, which must be different from the main one.
The IP range used in this example is 172.20.0.x, but you can pick any private IP range and adjust the create_ap command accordingly.
Device on extended wifi can speak to the main wifi, but main most likely won’t be able to see the devices on extended. If you have a printer, or so, it should be on the one.
If you want this to happen you should :
– reserve an IP on your main wifi for the raspberry MAC, so as it always gets the same IP
– add a route on your main router, that state, network 172.20.0.x can be reached via IP-YOU-RESERVED for the raspberry
I won’t go more in details, since the point was to get wifi network extended, and connect your wifi devices from bigger range.
I might add french later one, and will test this and adjust if need be, as i said, i have it running, but did not redo everything from scratch :D
Happy new year 2019 :D
![]()
Ajouter un commentaire
Pages
- À propos
- Alexandre Blanc Experience or work background
- Connected=hacked, cloud=leak, why
- Keeping track for my speaking events / appearances
- My take on Zero Trust – SP 800-207
- Openvpn and pihole on OVH VPS Server FAQ
- Raspberry 3 router project FAQ
- Spotting LinkedIn fake profiles, the tail of industrial spying, should I trust this contact ?
Search this Site
Archive
- août 2026
- avril 2025
- juin 2024
- mai 2024
- mars 2024
- février 2022
- janvier 2022
- octobre 2021
- septembre 2021
- mai 2021
- octobre 2020
- juin 2020
- avril 2020
- avril 2019
- janvier 2019
- juin 2018
- mars 2017
- octobre 2016
- août 2016
- mai 2016
- septembre 2015
- mai 2015
- février 2015
- novembre 2014
- septembre 2014
- août 2014
- janvier 2013
- décembre 2012
- juillet 2012
- janvier 2012
- novembre 2011
- octobre 2011
- mai 2011
- avril 2011
- mars 2011
- février 2011
- janvier 2011
- décembre 2010
- novembre 2010
- octobre 2010
- septembre 2010