The Wi-Fi in our house is pretty decent, but my room is very far off from the study room where the router is located. Which means that my streaming box loses the connection a couple of times throughout the hour, which is really not optimal when you’re streaming movies. After watching the spinning icon for the umpteenth time, I decided to extend the range of the signal with a Wi-Fi access point.

I had a spare Raspberry Pi, some time to kill, and an Ethernet cable to my room. Should be pretty easy, right? Most of the tutorials online, however, only taught how to make a Wi-Fi repeater with a Raspberry Pi. Now, for the unaware, a Wi-Fi repeater is terrible because you’re essentially cutting the bandwidth in half and causing more congestion for the network in your area. An AP (access point), on the other hand, is significantly better because the communication between your Raspberry Pi and your router happens through the Ethernet jack, leaving the radio on the Raspberry Pi free for all client devices to communicate.

So let’s get started! This guide assumes you have the latest Raspbian Stretch Lite flashed on a SD card inside the Raspberry Pi.

I want to configure the Pi headless

Skip this part if you intend to configure your Raspberry Pi with a monitor, keyboard, and mouse.

Connect your SD card to your computer. If your operating system asks if you want to format your card, do NOT select format. If you’ve accidentally formatted the card, burn the Raspbian Stretch image again.

Create an empty file called ssh or ssh.txt inside the /boot partition of the USB. This asks the Pi to enable SSH on first boot. Eject the card and plug it into the Pi. Make sure the Pi is connected to an Ethernet network.

Start up the Pi and connect to it using SSH. If you don’t know the Pi’s IP address, download Fing on your phone (Android/iOS) and do a scan on your network. If that doesn’t show anything, try running arp -a on any terminal. If that doesn’t work, use nmap. As a last resort (and potentially the first place you might check if your router is decent), connect to the router’s administration page and check the DHCP leases. My router is capable of this but it never showed any devices in the list except the one I was connecting from, so the feature was absolutely useless for me.

Initial configuration

The default username and password is pi and raspberry. Let’s first change the password! Change the password using passwd.

Then, run the following:

sudo apt update
sudo apt upgrade -y
sudo rpi-update
sudo reboot

This updates your core system and reboots your Pi. Once the Raspberry Pi comes back up, install the necessary dependencies. Run:

sudo apt install hostapd bridge-utils

Once that’s done, we need to stop hostapd. Run:

sudo systemctl stop hostapd

This is because we don’t need it for now and we need it disabled to edit the configuration.

Let’s create a bridge interface:

sudo brctl addbr br0

This is what the Wi-Fi clients will use while connecting. Now edit the configuration file of hostapd:

sudo nano /etc/hostapd/hostapd.conf

Paste the following:

interface=wlan0
bridge=br0
# driver=nl80211
ssid=SSID_NAME_HERE
hw_mode=g # Available options are a for 5GHz, and b and g for 2.4GHz
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=PASSWORD_HERE
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

You must comment out driver or else it will fail. Once finished, type Ctrl-O, and then Enter to save. Type Ctrl-X to exit.

Now we need to tell hostapd where our configuration is:

sudo nano /etc/default/hostapd

Find this line:

#DAEMON_CONF=""

And remove the pound symbol in front of it (#). Add your configuration file path:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Save and exit.

We need to now bridge the two connections. Run:

sudo brctl addif br0 eth0

Now we need to add the bridging configuration to the network interface configuration:

sudo nano /etc/network/interfaces

Edit it like the following:

allow-hotplug wlan0
iface wlan0 inet manual

auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0

We now need to prevent the Pi from assigning eth0 and wlan0 to new network interfaces. Add the following lines in /etc/dhcpcd.conf:

denyinterfaces wlan0
denyinterfaces eth0

Now enable hostapd:

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

Finally, run sudo reboot to start your new AP! When rebooting, there might be an error: Failed to start dhcpcd on all interfaces. This is normal and should be ignored.

Once that’s done, place your Pi where the Wi-Fi connection is weak and connect to the Pi to enjoy your new wireless access point!

Update

I had a bit of a performance issue with the Raspberry Pi Wi-Fi access point, and wondered why it was considerably slower than the main Wi-Fi access point.

To test this, I set up an iperf3 server and then ran tests between my laptop (a ThinkPad X250) and the server, going through the Pi-AP or directly. The results were disappointing. The direct connection gave me 100Mbps of throughput - very well, seeing as this is Cat.5 cable, but the Pi-AP gave about 20Mbps. What the hell?

I tried using a different, crappy Chinese AP, and it gave me a consistent throughput of 70Mbps. About what I was expecting, give or take. I have two theories as to what is going on. Theory number one is that the Pi is under-powered, and therefore suffers from Ethernet/Wi-Fi lag. Theory number two is that the packets first go to the router (or default gateway) for inspection, come back to the Pi and then go to the intended recipient. Then the cycle repeats as the packets make their way back to the client.

So this project will work in a cinch, but performance will definitely suffer and you’ll be better off with an actual access point in the long run.