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. If you find this helpful, please leave a comment or donate £1 :D.
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 firstname.lastname@example.org (change x.x.x.x to your IP) with the password “raspberry.”
Products from Amazon.com
Price: $34.49Was: $35.70
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) -- "PermitRootLogin" Change to -- PermitRootLogin Yes" sudo passwd root Use password "bob" su root ssh-keygen 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. X:\cygwin64\home\Username\.ssh Change server settings using SFTP and instead of "Logon Type" "Normal" select "Key File" X:\cygwin64\home\Username\.ssh\id_rsa Check you can connect and then close FileZilla passwd -d root (removes password) apt-get update apt-get upgrade nano /etc/rc.local Above exit 0 -- /usr/bin/tvservice -o reboot This should disable the HDMI port from working and save some power. /opt/vc/bin/vcgencmd measure_temp
apt-get install hostapd apt-get install dnsmasq nano /etc/dhcpcd.conf add to bottom -- denyinterfaces wlan0 nano /etc/network/interfaces add -- iface eth0 inet manual allow-hotplug wlan0 auto br0 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 ifdown wlan0 ifup wlan0 nano /etc/hostapd/hostapd.conf add -- interface=wlan0 driver=nl80211 hw_mode=g channel=6 ieee80211n=1 wmm_enabled=1 ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] macaddr_acl=0 ignore_broadcast_ssid=0 # Use WPA2 auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP # This is the name of the network ssid=RPIE-AP # The network passphrase wpa_passphrase=buggy bridge=br0 nano /etc/default/hostapd Replace -- #DAEMON_CONF="" DAEMON_CONF="/etc/hostapd/hostapd.conf" nano /etc/init.d/hostapd Replace -- DAEMON_CONF= DAEMON_CONF=/etc/hostapd/hostapd.conf mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig nano /etc/dnsmasq.conf Add -- 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 nano /etc/sysctl.conf Replace -- #net.ipv4.ip_forward=1 net.ipv4.ip_forward=1 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" nano /etc/rc.local Above "Exit 0" Add -- iptables-restore < /etc/iptables.ipv4.nat service hostapd start service dnsmasq start reboot 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.Affiliate information.