Rasberry Pi Mesh Point

Background

A mesh point is a combination of a Wi-Fi Access Point and a Wi-Fi 802.11s mesh node. The Access Point allows Wi-Fi clients to connect following the well understood Wi-Fi AP-client protocol.

The mesh node connects peer-to-peer from Access Point to Access Point. This allows for a distributed network with multiple AP's that can route traffic through a peer-to-peer mesh configuration while still supporting standard Wi-Fi clients.

To do this we need to set up and configure two Wi-Fi interfaces. The first is a normal Access Point interface. The second is the mesh node interface. These two interfaces are combined into a network bridge device that routes packets between Wi-Fi clients attached to the AP and the mesh network backplane from AP to AP.

Raspberry Pi model 3 or 4

Create an SD-Card for a Raspberry model 3 or 4 from the Raspbian 32-bit or 64-bit disk images found on the Raspberry Pi organization website. This is done with the Raspberry Pi firmware imaging tool.

Boot the RPi from the SD Card image.

At a command prompt window, first update the operating system to the latest version.

sudo apt update
sudo apt upgrade

Install TD-XPAH Drivers

Following the instructions on our 'Installing Drivers' page install the Linux drivers on your Raspberry Pi. This may take some time on the RPi 3 models.

Configuring the Access Point

The Access Point is configured following our Raspberry Pi Access Point configuration tutorial. Once you have the Access Point running and tested, you can continue to configure the mesh node following the instructions below.

Add Bridge Utilities

Add the bridge utilities to your operating system.

sudo apt install bridge-utils

Change AP Configuration File

Edit the hostapd configuration file and uncomment the 'bridge=' line.

sudo nano /etc/hostapd/ap_halow_open.conf

OR

sudo nano /etc/hostapd/ap_halow_sae.conf

Uncomment the bridge line by removing the '#' character so it looks like this.

bridge=br0

Save the file via command Ctrl-O and exit with Ctrl-X.

Add Mesh Device

Create the file wlan1 in the /etc/interfaces.d/ directory.

sudo nano /etc/interfaces.d/wlan1

Add the following lines to this file.

allow-hotplug wlan1
iface wlan1 inet manual
pre-up iw phy nrc80211 interface add mesh0 type mesh
pre-up iw dev mesh0 del

Save the file via command Ctrl-O and exit with Ctrl-X.

Add Bridge Device

Create the file br0 in the /etc/interfaces.d/ directory.

sudo nano /etc/interfaces.d/br0

Add the following lines to this file.

auto br0
iface br0 inet static
    address 192.168.200.10
    broadcast 192.168.200.255
    netmask 255.255.255.0
    gateway 192.168.200.1
    bridge_ports mesh0

The address, broadcast, netmask, and gateway should be changed to values appropriate to your network.

Note that the wlan1 Access Point device will be added to the br0 bridge device by hostapd.

Save the file via command Ctrl-O and exit with Ctrl-X.

Configure wpa_supplicant

Download a Wi-Fi mesh configuration file from the Teledatics github server. If you do not need encryption, download the mp_halow_open.conf configuration file. If you would like to use 802.11ah SAE encryption, download the mp_halow_sae.conf configuration file.

The file should saved to the /etc/wpa_supplicant directory.

Edit the configuration file and change the 'ssid' parameter to match your network's 'mesh id'.

sudo nano /etc/wpa_supplicant/sta_halow_open.conf

OR

sudo nano /etc/wpa_supplicant/sta_halow_sae.conf

Change the 'ssid' line.

ssid="<your 'mesh id' value>"

Do not forget the quotes around the 'mesh id' value.

Note that even though the parameter name is still 'ssid' this is not the same SSID used by the Wi-Fi Access Point and clients. The wpa_supplicant daemon uses the ssid parameter value as the 'mesh id' internally. This occurs whenever the 'mode' parameter is set to 5 (i.e. mesh point). The 'mesh id' must be the same on all mesh nodes.

If you are using the SAE encryption configuration file, change the psk value to the mesh node encryption key. Note that this encryption key can differ from the Access Point - client encryption key.

psk="<your encryption key>"

Do not forget the quotes around the encryption key value.

The encryption key value must be the same on all mesh nodes.

Save the file via command Ctrl-O and exit with Ctrl-X.

Copy this file to wpa_supplicant-mesh0.conf.

sudo cp /etc/wpa_supplicant/sta_halow_open.conf /etc/wpa_supplicant/wpa_supplicant-mesh0.conf

OR

sudo cp /etc/wpa_supplicant/sta_halow_sae.conf /etc/wpa_supplicant/wpa_supplicant-mesh0.conf

Re-configure dhcpcd.conf

During Access Point set up we configured the dhcpcd.conf to assign the Access Point wlan1 interface a static IP address. Since we are using a bridge device, we need to remove the lines that add the static IP address for the wlan1 interface.

Edit the dhcpcd.conf file.

sudo nano /etc/dhcpcd.conf

Remove the following lines.

static ip_address=192.168.200.2/24
static routers=192.168.200.1

Save the file via command Ctrl-O and exit with Ctrl-X.

Change Firewall Rules

Edit the firewall rules file and change interface 'wlan1' to 'br0' wherever 'wlan1' appears in the file.

sudo nano /etc/nftables/nft-halow-ap.nft

Save the file via command Ctrl-O and exit with Ctrl-X.

Reboot

Reboot your Raspberry Pi and your TD-XPAH Mesh Point will be active.