In this tutorial, I will explain how you can use your Raspberry Pi 3 b as a Wireless Access Point to extend the range of your WiFi network.
Why would I want to do this?
I have recently pre-ordered the Samsung Galaxy Note 8 and I’ve noticed a few WiFi drops around my house, specifically my bed. I’d like to be able to play movies and browse YouTube while in bed and the WiFi signal simply isn’t strong enough–first world problems… I’ve looked around for years for something that does what I want, and a lot of the devices are expensive or simply not that good.
I’ve always been intrigued by the Raspberry Pi, especially the latest model, the Raspberry Pi 3 b, and as they can use an operating system I am familiar with (I use Raspbian, but it’s based on Linux Debian) I thought it wouldn’t be too difficult to set up and use as a wireless access point. I was correct, and I’m really impressed with the little device. Normally you expect to start a project like this and encounter unforeseen problems, but honestly it did not take much time to figure out at all.
There are a few guides online but none seem to network properly and as such, if you want to connect with other computers on the same network and browse the files–let’s assume you want to open a video file on a server computer–you won’t be able to.
Getting started with the Raspberry Pi 3 b
If you shut yourself out of the raspberry pi 3 b system, Paragon ExTFS for Windows (the trial version is fine) allows you to edit these files from a windows system. I recommend installing cygwin with mintty. Select “mintty” and “ssh” in the install phase, when it’s complete, create a shortcut with the properties X:\cygwin64\bin\mintty.exe /bin/bash -l. Note, cygwin cannot be in a subfolder. If you have troubles with cygwin, you can try putty but I think it’s ugly. Alternatively, leave a message below and I’ll try help.
First things first, you’ll need to buy a MicroSD card; I recommend a Samsung 16GB MicroSD, a Raspberry Pi 3 b or Raspberry Pi 3 b starter kit, and an ethernet cable. If you do not have access to an ethernet socket then you are screwed. This method uses an ethernet port and converts it into a Wireless signal. If you have an ethernet port but it’s used for your computer, you can buy a simple network switch; I recommend a netgear ethernet switch.
- Download Raspbian and install it to your MicroSD card.
- Install raspbian with etcher (etcher is a free program.)
- Put a file called “ssh” (it can contain anything as it’s deleted after you log in) into the boot directory.
- Insert the MicroSD card into the Raspberry Pi 3 b.
- Power on the Raspberry Pi 3 b (when the usb cable is inserted, it will automatically power on) and get its IP from your router.
- SSH into the account email@example.com (change x.x.x.x to your IP) with the password “raspberry.”
Products from Amazon.com
Price: $15.95Was: $19.95
Price: $34.78Was: $35.70
Price: $9.94Was: $10.98
I bought this snazzy flirc case but I still need to make a case for my OLED. You do not need to buy an OLED for the raspberry pi 3 b to function as an access point.
Now you have access to the Raspberry Pi 3 b console
Here’s where things get a little more complicated, but you should be able to paste most of this and it won’t take too long to set up.
sudo nano /etc/ssh/sshd_config
Find (ctrl + w) --
Change to --
sudo passwd root
Use password "bob"
Hit return a bunch of times
Get filezilla and connect to the raspberry pi 3 b ip with username "root" and password "bob" with "SFTP" as the type.
Download .ssh folder and move it to your cygwin directory, then disconnect from server.
Change server settings using SFTP and instead of "Logon Type" "Normal" select "Key File"
Check you can connect and then close FileZilla
passwd -d root (removes password)
Above exit 0 --
This should disable the HDMI port from working and save some power.
apt-get install hostapd
apt-get install dnsmasq
add to bottom -- denyinterfaces wlan0
iface eth0 inet manual
iface br0 inet dhcp
bridge_ports eth0 wlan0
pre-up ifconfig eth0 0.0.0.0 up
pre-up ifconfig wlan0 0.0.0.0 up
pre-up brctl addbr br0
pre-up brctl addif br0 eth0
post-down ifconfig wlan0 0.0.0.0 down
post-down ifconfig eth0 0.0.0.0 down
post-down brctl delif br0 eth0
post-down brctl delbr br0
apt-get install bridge-utils
service dhcpcd restart
# Use WPA2
# This is the name of the network
# The network passphrase
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
interface=wlan0 # Use interface wlan0
# listen-address=192.168.220.1 # Specify the address to listen on
bind-interfaces # Bind to the interface
# server=18.104.22.168 # Use Google DNS
# domain-needed # Don't forward short names
# bogus-priv # Drop the non-routed address spaces.
# dhcp-range=192.168.200.50,192.168.200.150,12h # IP range and lease time
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
sh -c "iptables-save > /etc/iptables.ipv4.nat"
Above "Exit 0"
iptables-restore < /etc/iptables.ipv4.nat
service hostapd start
service dnsmasq start
change wifi password -- nano /etc/hostapd/hostapd.conf
passwd -d pi (removes pi password now that you can log in as root)
update-rc.d dhcpcd disable
update-rc.d -f dhcpcd remove
I need to tidy up the commands and give a bit of an explanation, as it’s written in a bit of a confusing way at the moment. I will get around to doing that later, also, I plan to write another guide. In my next guide, I will explain how you can access router logs, information, and create a bandwidth monitor that’s displayed on a cheap OLED.
There’s still a few things I’d possibly like to set up, but I’m not sure yet:
- Raspberry Pi 3 b deauth signal so that when the main router’s signal is greater than the Raspberry Pi 3 b, my phone will automatically reconnect to the router
- Raspberry Pi 3 b set to have the same SSID and password as the main router but filter MAC addresses so only my equipment can connect to it
If I do set this up, I will update this page with information on how to do it.