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 😀

Happy new year 2019 😀

mardi, janvier 1st, 2019 Technologie

Ajouter un commentaire

Not f'd — you won't find me on Facebook
janvier 2019
L M M J V S D
« Juin    
 123456
78910111213
14151617181920
21222324252627
28293031  
 

 
Suivez moi sur twitter - follow me on twitter
[FSF Associate Member]
 
Free Software, Free Society
VIRTUALISATION :
Compacter une image virtualbox VDI
Bon petit tutoriel esxi
Marche d'appliances vmware
Installer ESXi sur un disque IDE
Installer ESXi 3.5 sur un disque USB
Installer proxmox avec DRBD et migration / réplication à chaud
Installer OSSEC avec VMware
Information sur le VDI
SECURITE - FIREWALL :
Ouvrir des ports dynamiquement iptables - knockd
Autre tres bon tuto knockd
Docs Arp poisoning - Anglais
Metasploit test de pénétration
Zone H - sites piratés en temps réel
Blog invisible things
Tips protection sécurité wordpress
Pfsense - distribution firewall opensource - adsl internet failover
Iproute 2 mini how to - linux advanced routing
ClearOS - la passerelle sécuritaire lan - wan
HAUTE DISPONIBILITE :
CDN - Accélération de la distribution de données
drbd iscsi ocfs2 dm multipath tutoriel
Load balancing LVS
Load balancing opensource list
HA-Proxy :
HAproxy - http load balancer
Simple tutoriel HAproxy
HAproxy - debian tutoriel
Centos - Ip failover
Configuratoin DM-Multipath Redhat
VMware Doubletake - continuité
Quelques liens sur la réplication MySQL : Manuel MySQL, chapitre sur la réplication
Manuel MySQL, Tutoriel clair sur la mise en place
Autre tuto sur la mise en place de la réplication MySQL
Références pour optimisation du serveur MySQL
Utilisation de EXPLAIN mysql pour optimiser vos bases
optimiser vos bases - requetes et index
STOCKAGE RESEAU :
Un outil de clonage disque en reseau
Internet NAS 250Go 250 accès VPN
Server ISCSI avec Ubuntu tuto
ISCSI centos redhat tutoriel
Gérer et étendre un LVM
Créer sa piratebox ! trop cool
Deaddrops, les clés USB dans les murs, aussi cool !
OPTIMISATION WORDPRESS :
Télécharger Xenu
Comment utiliser Xenu
optimisation hébergement wordpress
Super howto wordpress (En)
Test de charge serveur web - Load impact
VPN - ROUTEUR - LAN:
Zeroshell - le mini-routeur wifi tout en un
Retroshare, votre réseau d'échange crypté!
Openvpn sur centos redhat
Intégrer Linux dans active directory
Routage inter-vlan avec Linux
Routage avec OSPF
Network Weathermap
TENDANCES - WEB:
Boutons twitter
Analyser les tendances des recherches Google
Protocole sitemap - robots.txt
Creer des animations CSS3
Code php pour interagir avec twitter
E reputation
Jquery
TRUCS ET ASTUCES GNU/LINUX :
Tuxmachines.org - Actus et tips linux
Configurer GRUB2 et grub2 ici
Panoet - en anglais - tips & tricks
Readylines tips and trick pertinents
Squid Clamav - proxy antivirus
Apprendre Unix en 10 minutes
13 tips sur les expressions régulières
IE Sous linux IES
LDAP 2.4 Quickstart guide
Tutoriel LDAP
Installation annuaire LDAP
Serveur Mail Postfix - Dovecot - LDAP - MDS
Créer un linux personnalisé en ligne - custom linux
Super site sur linux - en
Capistrano - déploiement automatisé
MONITORING :
Nagios tutoriel et doc
Nagios plugin NRPE tuto
Nagios plugin NRPE autre tuto
Nagios plugin NRPE officiel
Zabbix - fonctionnalités
Zabbix - installation
Guide MRTGsys - grapher la charge locale
MRTGsys - ajouter des graphs
MRTGsys - interpréter les données
Shinken - Monitoring
Thruk Monitoring webinterface
Shinken - Tutoriel
Shinken - Référence chez Nicolargo
AUTRES LIENS :
RemixJobs IT jobs
USB Multiboot
Reset mot de passe windows
Java python et autres tips, intéressant !
Forum inforeseau
Open Clipart
Excellent comic en ligne
Inforeseau.fr
 
Contrat Creative Commons
This création is licensed under a Creative Commons Paternité - Pas d'Utilisation Commerciale - Partage des Conditions Initiales à l'Identique 2.0 France License.