- Saved searches
- Use saved searches to filter your results more quickly
- License
- ArieLevs/Raspberry-WiFi-Repeater
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Setting Up a Wi-Fi Extender Using a Raspberry Pi
- Table of contents
- Prerequisites
- Extending the Wi-Fi using Raspberry
- Step One: Updating the Raspberry Pi
- Step Two: Installation of the dnsmasq and hostapd packages
- Step Three: Open the dhcpcd.conf
- Step Four: Setting up the wlan1 connection
- Step Five: Restarting dhcpcd service
- Step Six: Modification of the hostapd configuration
- Step Seven: Adjust the hostapd configuration files
- Step Eight: Change directory of the dnsmasq.conf
- Step Nine: Creation of a new dnsmasq.conf configuration file
- Step Ten: Traffic forwarding configuration
- Step Eleven: Activation of IP forwarding on the Pi
- Step Twelve: NAT configuration
- Step Thirteen: Restart the Raspberry Pi
- Conclusion
- Relevant Sources
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Guide to set raspberry pi as wifi access point — bridge
License
ArieLevs/Raspberry-WiFi-Repeater
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Raspberry pi as Wi-Fi repeater
This is a simple guide to set Raspberry pi as Wi-Fi repeater, I know there are many guides out there, including the official, but none of them worked 100% without modifications.
Based on: Linux raspberrypi 5.10.63-v7+ (Raspbian 10 buster)
In order to achieve our goal we will need to set up two separate interfaces, You will need additional Wi-Fi usb device or use the ethernet connection.
Let’s assume your home lan address is 10.0.0.0/24, We will extend this network using another lan at address 10.0.1.0/24.
This guide assumes the OS is a clean installation and running, with the Wi-Fi\ethernet interface to the router «10.0.0.0/24» is set up.
wlan0 interface is being configured (10.0.22.0/24 network) # Option 1 | | +- Router ----+ +--- Raspberry ---+ / +- Laptop ----+ | DHCP server | | 10.0.0.18 |/ | WLAN Client | (Internet)---WAN-+ +---LAN----|/ wlan0 AP +-))) (((-+ | | 10.0.0.0/24 | | 10.0.22.1|\ | 10.0.22.36 | +-------------+ +-----------------+ | +-------------+ | new network DHCP server # Option 2 | +- Router ----+ +--- Raspberry ---+ | +- Laptop ----+ | DHCP server | WiFi | 10.0.0.18 |/ | WLAN Client | (Internet)---WAN-+ +-))) (((-|/ wlan0 AP +-))) (((-+ | | 10.0.0.0/24 | | 10.0.22.1| | 10.0.22.36 | +-------------+ +-----------------+ +-------------+ -------------------------------------------------------------------------------------- # Option 3 (extended network) +- Router ----+ +--- Raspberry ---+ +- Laptop ----+ | DHCP server | | 10.0.0.18 (eth0)| | WLAN Client | (Internet)---WAN-+ +---LAN----|/ wlan0 AP +-))) (((-+ | | | | |\ | | | 10.0.0.0/24 | | br eth0wlan0 | \ | 10.0.0.36/24| +-------------+ +-----------------+ \ +-------------+ | | wlan0 interface is being configured (extend original 10.0.0.0/24 network)
Automatic Installation via Ansible:
Execute from project root directory
(note for the , below, or the ip/dns will be considered a hosts inventory filename) the configured device ip from above example is 10.0.0.18
- if updating country variable make sure country is a valid Alpha-2 code ISO 3166-1 country code
- Custom access point CIDR can be provided by passing these variables: (view defaults)
ap_ip_addr="10.0.1.1/24" ap_start_ip_addr="10.0.1.2" ap_end_ip_addr="10.0.1.100" ap_subnet_mask="255.255.255.0"
options 1 OR 3 install example:
With option one/three you bridge eth0 wlan0 and probably connected to raspberry pi via LAN Ethernet cable (to ip 10.0.0.18 ), so only the configured access point name/pass should be provided (if not provided default ap_ssid_name and ap_ssid_pass will be set to nalkinscloud )
ansible-playbook -u pi --ask-pass \ -i "10.0.0.18," \ ansible/setup_repeater.yaml \ -e ap_ssid_name=AP_SSID \ -e ap_ssid_pass=AP_PASSWORD \ -e country="FI" ## add below variable to deploy as an extended network #-e extended_network=True
option 2 install example:
With option two/four you bridge wlan0 wlan1 and probably want to ssh to raspberry via the Wi-Fi interface ( 10.0.0.8 ), in this case you should manually set up wpa_supplicant as described below.
If you connected via ethernet cable (to lets say 10.0.0.37 ) update relevant ip host.
the ssid_name and ssid_pass should contain your home Wi-Fi access.
ansible-playbook -u pi --ask-pass \ -i "10.0.0.18," \ ansible/setup_repeater.yaml \ -e ap_ssid_name="AP_SSID>" \ -e ap_ssid_pass="" \ -e ssid_name="" \ -e ssid_pass=""
When doing ip a you should have 4\3 interfaces, loopback, eth0 for lan cable connection, wlan0 is the onboard Wi-Fi and wlan1 is the usb Wi-Fi interface if connected.
wlan1 or eth0 will connect to your home LAN at 10.0.0.0/24
wlan0 will create a new network using 10.0.1.0/24, or it will extend your current 10.0.0.0/24 network if you choose to. then a bridge (br0) will bridge the interfaces.
for option 2 only set up (not needed when using eth0 connection to router), provide your home SSID and password sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
# update with relevant country country=US network=
Once raspberry was able to connect to the router (with internet access), do
sudo apt-get update sudo apt-get upgrade
Configure Access Point (hostapd)
sudo apt-get install hostapd
type sudo vi /etc/hostapd/hostapd.conf And append
# update with relevant country country_code=US interface=wlan0 ## un-comment below line if setting up extended network (options 3) # bridge=br0 ## comment out below line if setting extended network (options 3) driver=nl80211 ssid=[AP_SSID] hw_mode=g channel=6 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=[AP_PASS] wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Execute sudo vi /etc/default/hostapd and replace line #DAEMON_CONF with
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Ensure wireless operation (comply regulations)
sudo systemctl unmask hostapd sudo systemctl start hostapd
Configure sudo vi /etc/dhcpcd.conf
## set dhcpcd configure only br0 via DHCP ## Add to start of file denyinterfaces wlan0 eth0 ## THIS IS CURRENTLY NOT SUPPORTED ## with additional wifi, add below 3 lines #denyinterfaces wlan0 wlan1 #interface wlan0 # nohook wpa_supplicant ## Add to end of file interface br0
## configure a static IP for wlan1 (or eth0) and static IP for wlan0 ## Add to the end of file lines ## If using static IP with additional wifi (optional) #interface wlan1 # static ip_address=10.0.0.2/24 # static routers=10.0.0.1 # static domain_name_servers=10.0.0.1 8.8.8.8 ## If using static IP with ethernet (optional) #interface eth0 # static ip_address=10.0.0.2/24 # static routers=10.0.0.1 # static domain_name_servers=10.0.0.1 8.8.8.8 interface wlan0 static ip_address=10.0.1.1/24 nohook wpa_supplicant
Restart the service sudo service dhcpcd restart
sudo apt-get install bridge-utils
Execute sudo vi /etc/network/interfaces.d/raspberry_interfaces and add
auto br0 iface br0 inet dhcp bridge_ports eth0 wlan0 ## THIS IS CURRENTLY NOT SUPPORTED ## or if setting wlan1 with wlan0 (option 4) #bridge_ports wlan1 wlan0
All set! clients not should be able to connect to the Wi-Fi network chosen at [AP_SSID] and get an IP address from extended router.
Add Routing — Repeater — only for routed network (options 1/2)
sudo apt-get install dnsmasq
Set up the DHCP server (dnsmasq)
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo vi /etc/dnsmasq.conf
interface=wlan0 dhcp-range=10.0.1.2,10.0.1.100,255.255.255.0,12h
sudo systemctl start dnsmasq
sudo apt-get install iptables
type sudo vi /etc/sysctl.conf and uncommon line:
net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1
## if using eth0 as connection to router #inter=eth0 inter=wlan1 sudo iptables -t nat -A POSTROUTING -o $ -j MASQUERADE sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Edit sudo vi /etc/rc.local and append above «exit 0» line
iptables-restore /etc/iptables.ipv4.nat
- only if setting wlan1 append to /etc/network/interfaces.d/raspberry_interfaces file:
# Bridge setup auto br0 iface br0 inet manual bridge_ports wlan1 wlan0
About
Guide to set raspberry pi as wifi access point — bridge
Setting Up a Wi-Fi Extender Using a Raspberry Pi
A wifi extender is important in cases where the network is not strong enough past certain ranges. This extender can be used in small areas such as an office or home.
The Raspberry Pi Wi-Fi Extender is a low-cost and high-power device that can help extend your Wi-Fi network range. It mainly establishes its network connection from a Wi-Fi adapter. A Wi-Fi extender is important in cases where the network is not strong enough past certain ranges. This extender can be used in small areas such as an office or home.
Table of contents
Prerequisites
- Raspberry Pi 3
- Power cable
- Wi-Fi adapters
- Raspberry Pi Case (optional)
Extending the Wi-Fi using Raspberry
To create a Wi-Fi extender using a Raspberry Pi, the dnsmasq package in Linux is used. This package is important as it takes care of the majority of the technical work for you by functioning as both your DNS and DHCP server, that are needed to form a connection.
You’ll also need to install the hostapd package that allows us to create the extender. It is essential to have a Wi-Fi router that is active for you to make a connection as well as an Ethernet device for bridging the connection.
Step One: Updating the Raspberry Pi
Before installing the packages, you should perform an update: sudo apt-get update and sudo apt-get upgrade .
Step Two: Installation of the dnsmasq and hostapd packages
Install the dnsmasq and hostapd packages using these commands:
sudo apt-get install dnsmasq
sudo apt-get install hostapd
Step Three: Open the dhcpcd.conf
This can be achieved using this command: sudo nano /etc/dhcpcd.conf
Step Four: Setting up the wlan1 connection
interface wlan1 static ip_address=192.168.5.1/24 static routers=192.168.5.0
Step Five: Restarting dhcpcd service
sudo service dhcpcd restart
Step Six: Modification of the hostapd configuration
sudo nano /etc/hostapd/hostapd.conf
- Here we dictate how we can communicate and interact with the WLAN device by changing the following lines:
ssid= " " //here you enter the name of the Wi-Fi wpa_passphrase=" " //here you enter the password of the Wi-Fi
Step Seven: Adjust the hostapd configuration files
Using nano editor: sudo nano /etc/default/hostapd
- Open the other configuration file in init.d using: sudo nano /etc/init.d/hostapd
- Look for #DAEMON_CONF= and replace using DAEMON_CONF=/etc/hostapd/hostapd.conf
Step Eight: Change directory of the dnsmasq.conf
First, change the directory of the configuration using: sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Step Nine: Creation of a new dnsmasq.conf configuration file
- Create a new conf file using: sudo nano /etc/dnsmasq.conf
- Type the following into the new file to help communicate with the dnsmasq service and tell it how to deal with all connections being made.
interface=wlan1 # Specification of interface listen-address = 192.168.5.1 # Specification of listening address bind-interfaces # Binding interface server=8.8.8.8 # Setting up Google DNS domain-needed # Limit forwarding of names that are not domain names bogus-priv # Drop the non-routed address spaces dhcp-range=192.168.5.50,192.168.5.150,12h # IP range and lease time
Step Ten: Traffic forwarding configuration
Next, we configure the Raspberry Pi to forward the traffic so that it works like a router. This can be achieved using: sudo nano /etc/sysctl.conf .
Find and eliminate # sign at the beginning (Uncomment): #net.ipv4.ip_forward=1
Step Eleven: Activation of IP forwarding on the Pi
Activate the Raspberry Pi using the command below: sudo sh -c «echo 1 > /proc/sys/net/ipv4/ip_forward»
Note: You may reboot at this point in order to apply the settings:
Step Twelve: NAT configuration
Configure the NAT between the wlan0 and wlan1 interface as a way of forwarding traffic using:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT
To save: sudo sh -c «iptables-save > /etc/iptables.ipv4.nat»
Now we have to ensure that our configuration is be loaded locally every time the Raspberry Pi boots up First, open rc.local using: sudo nano /etc/rc.local . Then insert iptables-restore < /etc/iptables.ipv4.nat above exit 0
sudo service hostapd start sudo service dnsmasq start
Step Thirteen: Restart the Raspberry Pi
Finally, run the following command: sudo reboot to restart the Raspberry Pi. To test it works, use any wireless devices to connect to it using the Wi-Fi network name and password you created.
Conclusion
Congratulations. You’ve turned your Raspberry Pi into a Wi-Fi extender which will help boost your Wi-Fi signal further.
Relevant Sources
Peer Review Contributions by: Collins Ayuya