This tutorial will show you how to extend your wireless network with a Raspberry Pi. For this tutorial, I am using a Raspberry Pi 4, 4GB model in a SunFounder Acrylic case. I am powering the Pi with a standard 5V, 2A charger, which is enough to power this headless Pi without any other attachments. This microcomputer also contains my local web server.

Limitations

This will setup your Pi as either a G or an A network. It appears you can setup a dual network, but I did not do that. This means a few of my devices (those without ac wireless cards) will not be able to see this network. Note, we will fix an error that is present on the documentation (as of the time in writing this). This tutorial will follow the Bridged Wireless Access Point. Pi does have documentation for creating the Routed Access Point. This tutorial assumes you already have Raspberry Pi OS setup on your device. You will also want to work directly on the Pi with a keyboard and monitor rather than use SSH because these instructions may temporarily break your network connection.

Getting Started

To get your Pi setup as a Wireless Access Point, we are really just installing, unmasking, enabling, and configuring the hostapd Debian package. The first several steps of the Pi documentation is perfectly correct. These are the commands and what they are doing: This installs the hostapd package to bridge your network together:

sudo apt install hostapd

The first command makes the hostapd package visible to the system network controllers and the second enables the package to boot on system boot:

sudo systemctl unmask hostapd sudo systemctl enable hostapd

This creates a new file to define the network bridge that links the Ethernet port to the Wireless card:

sudo nano /etc/systemd/network/bridge-br0.netdev

This is the defining the bridge as “br0” as a “bridge”, meaning multiple ports are connected:

[NetDev]
Name=br0
Kind=bridge

This creates a new file defining the “eth0” Ethernet port as being part of the bridge:

sudo nano /etc/systemd/network/br0-member-eth0.network

This is the code for the new file:

[Match]
Name=eth0
[Network]
Bridge=br0

And this will enable the new bridge with the definitions on boot:

sudo systemctl enable systemd-networkd

Setting Up the IP address on the network

The DCHP config file on the Pi asks for an IP address for each network port. Since we want only one IP address shared across the bridge, we need to disable the Ethernet and Wireless point, and assign a shared IP for the bridge. This command opens that configuration file:

sudo nano /etc/dhcpcd.conf

And this blocks the Eth0 and wlan0 ports, but adds the br0 to the request for an IP address:

denyinterfaces wlan0 eth0
interface br0

The first line should go somewhere near the top of the file and the second line should go near the bottom of the file.

Creating the Wireless Connection

The first step to using the Wireless Access Point is to setup the wireless card on the Pi to broadcast. You can only do this once the Pi knows your country, which you supplied while setting up your OS. Run this command to unlock the ability for the Pi to transmit wireless signals:

sudo rfkill unblock wlan

Next, we need to configure the Pi so your devices can connect to the wireless access point. We will create a new file to manage that configuration:

sudo nano /etc/hostapd/hostapd.conf

The hostapd file can be complicated. If you need help understanding or troubleshooting, check out the basic default config file here, in these are the only lines we need to get the access point to work:

country_code=US
interface=wlan0
bridge=br0
ssid={YourNetworkSSID}
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase={yourpasscode}
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

You need to input your correct county code, and you can find that this here. The ssid line is your preferred network name (no quotation marks) and the wpa_passphrase is your password to access the network. This document will set up a “g” wireless network on the 2.4GHz band. If you want to use “a” instead on the 5 GHz band, you will need to change hw_mode to “a” but you will also need to know what channel your Pi can broad on. This command lists the channels:

iw list

You will see the outputs on Band 1 and Band 2. Here are the frequencies on my Band 1:

* 2412 MHz [1] (20.0 dBm)
* 2417 MHz [2] (20.0 dBm)
* 2422 MHz [3] (20.0 dBm)
* 2427 MHz [4] (20.0 dBm)
* 2432 MHz [5] (20.0 dBm)
* 2437 MHz [6] (20.0 dBm)
* 2442 MHz [7] (20.0 dBm)
* 2447 MHz [8] (20.0 dBm)
* 2452 MHz [9] (20.0 dBm)
* 2457 MHz [10] (20.0 dBm)
* 2462 MHz [11] (20.0 dBm)
* 2467 MHz [12] (disabled)
* 2472 MHz [13] (disabled)
* 2484 MHz [14] (disabled)

The numbers in the [brackets] show the channels. So for “g” as the setting in hw_mode, I can use any number between 1-11 for the channel. My Band 2 has a larger range of channels, I selected 165 for my config file, but it could have been any channel that was not listed as disabled. Once I have my config file set, reboot the Pi and you should be able to access your network.