Openwrt Mesh 80211s
When I moved to the last apartment, there were too many wifi routers around me, and my old MikroTik (hAP ac lite) barely was able to cover my needs. It didn’t have external antennas, and with all the tuning, I wasn’t able to get even 100 MBit/s in all rooms. At the same time, my old friend purchased a new Chinese Xiaomi router. At that time, it was powerful and not expensive. So, I decided to try it. After about 6 months of waiting (it was the beginning of COVID), I finally got a router. It worked great out of the box, much better than my ten times tuned MikroTik. At some point, we moved to a house, and one router couldn’t cover all areas. Therefore, I decided to extend the coverage by purchasing another Xiaomi router. It was one of the cheapest solutions, around $35. At the same time, this router finally got OpenWrt firmware.
My set up
I didn’t want to put extra cables and decided to try using it as wireless repeater.
Router and how to setup OpenWRT: Xiaomi Redmi Router AC2100
Firmware version: 22.03.5
Devices:
- Primary mesh device
- This is the device that is connected to the internet (e.g. via a network cable to a cable/DSL modem)
- This device acts as a router and will manage the DHCP, DNS, and firewall for the network
- This device can also act as a wireless AP (access point)
- Secondary mesh device(s)
- These devices will extend the wireless network and act as wireless APs
Configuration steps
Main router:
Uninstall (note: it’s via SSH, do this on all devices):
opkg update
opkg remove wpad-mini
opkg remove wpad-basic
opkg remove wpad-basic-wolfssl
Install (note: do this on all devices):
opkg install wpad-wolfssl
Set up the mesh network using LUCI
-
Configure the LAN interface
-
Set the IP
On the primary mesh device you’ll want to set a static IP (e.g. 192.168.0.1). On the secondary mesh devices you can also set a static IP on the same subnet (e.g. 192.168.0.2) or you can use DHCP instead.
-
Set a static IP: Network > Interfaces > LAN > Edit > Change IPv4 address > Save
-
Use DHCP: Network > Interfaces > LAN > Edit > Protocol > DHCP client > Save > Apply unchecked
-
-
For all secondary mesh devices with a static IP:
-
Network > Interfaces > LAN > Edit
-
IPv4 gateway > Set to the IP of the primary mesh device (e.g. 192.168.0.1)
-
Use custom DNS servers > Add the IP of the primary mesh device
-
Save > Save & Apply
-
-
-
(Optional) Disable unnecessary services
For secondary mesh devices, you can optionally disable some services that will be provided by the primary mesh device
-
System > Startup
-
Click Enabled for each of these services (if you see Disabled, it means they’re already disabled):
- dnsmasq
- firewall
- odhcpd
(If you built your own OpenWrt package without these services (
-dnsmasq
,-firewall
,-odhcpd
), they will not be displayed on the Startup screen)
-
-
Configure the mesh wireless network
-
Network > Wireless
-
Either Add a new network or Edit an existing network
It shouldn’t matter whether the mesh network is the primary or secondary network
-
Under Device Configuration > General Setup
- Set Channel to a specific channel (this must be the same on all mesh devices)
-
Under Device Configuration > Advanced Settings
- Set Country Code
-
Under Interface Configuration > General Setup
-
Set Mode to 802.11s
-
Set the Mesh Id
This can be any string (e.g.
80211s-mesh
), but it must be the same on all mesh devicesI like to use a random value (e.g. generated using
openssl rand -hex 6
) since the mesh network may be visible by some clients -
Set Network to lan
This will prevent the firewall from blocking traffic between the mesh routers so all devices on the mesh network can see each other
-
-
Under Interface Configuration > Wireless Security
- Set Encryption to WPA3-SAE
- Set Key to a randomly generated secure string
-
Save > Save & Apply
-
If you see Wireless network is disabled under the mesh network, click Enable
-
-
Configure the wireless network for clients
Skip this step if you already have a wireless network for clients
-
Network > Wireless
-
Either Add a new network or Edit an existing network
Make sure you don’t edit the mesh network you just created 😄
-
Under Interface Configuration > General Setup
-
Set Mode to Access Point
-
Set ESSID to the same value on all routers
This will make the network look the same to clients so they can automatically switch between any of the mesh routers
-
Set Network to lan
-
-
Under Wireless Security
- Set Encryption to WPA2-PSK
- Set Key to the same values on all routers
-
Save > Save & Apply
-
Set up the mesh network over SSH
-
Connect to the device, e.g.
ssh [email protected]
-
(As needed) Set the root password
passwd
-
(As needed) Change the IP address
Make sure each router on the mesh network has a different IP on the same subnet (e.g. 192.168.0.2)
-
Edit
/etc/config/network
vi /etc/config/network
-
Under
config interface 'lan'
setoption ipaddr
-
Restart the network
service network reload
-
-
For all secondary mesh devices:
uci set network.lan.gateway='192.168.0.1' uci add_list network.lan.dns='192.168.0.1'
(Replace the IP address with the IP of the mesh device that is connected to the internet)
-
Configure the mesh wireless network
-
Edit
/etc/config/network
vi /etc/config/network
-
Under
config wifi-device 'radio0'
:-
Remove this line to enable the wireless radio:
option disabled '1'
-
Update the options to set the channel and country, e.g.
option channel '1' option country 'IO'
-
-
Still in
/etc/config/wireless
, add a new section to create the mesh interfaceconfig wifi-iface 'mesh' option device 'radio0' option network 'lan' option key 'gqjfjfn7smcKu&bx' option mesh_rssi_threshold '0' option mesh_fwding '1' option mode 'mesh' option mesh_id 'ef4ef8ebb23d' option encryption 'sae'
(Replace
key
andmesh_id
with your own values)
-
-
Restart the wireless interface
wifi
-
(Optional) Tail the logs to make sure it worked
logread -l 20 -f
e.g.
# logread -l 20 -f Fri Jan 8 18:31:12 2021 daemon.notice wpa_supplicant[2257]: wlan0: MESH-GROUP-STARTED ssid="ef4ef8ebb23d" id=0 Fri Jan 8 18:31:12 2021 daemon.notice wpa_supplicant[2257]: wlan0: new peer notification for 24:a4:3c:ae:df:83 Fri Jan 8 18:31:13 2021 daemon.notice wpa_supplicant[2257]: wlan0: mesh plink with 24:a4:3c:ae:df:83 established Fri Jan 8 18:31:13 2021 daemon.notice wpa_supplicant[2257]: wlan0: MESH-PEER-CONNECTED 24:a4:3c:ae:df:83
-
(Optional) View the mesh status
iw dev wlan0 station dump
e.g.
# iw dev wlan0 station dump Station 24:a4:3c:ae:df:83 (on wlan0) inactive time: 10 ms rx bytes: 11614506 rx packets: 50030 tx bytes: 13971217 tx packets: 23604 tx retries: 1760 tx failed: 0 rx drop misc: 3220 signal: -52 [-54, -56] dBm signal avg: -54 [-56, -58] dBm Toffset: 21971078389 us tx bitrate: 115.6 MBit/s MCS 13 short GI rx bitrate: 57.8 MBit/s MCS 11 short GI rx duration: 0 us expected throughput: 42.388Mbps mesh llid: 0 mesh plid: 0 mesh plink: ESTAB mesh local PS mode: ACTIVE mesh peer PS mode: ACTIVE mesh non-peer PS mode: ACTIVE authorized: yes authenticated: yes associated: yes preamble: long WMM/WME: yes MFP: yes TDLS peer: no DTIM period: 2 beacon interval:100 connected time: 1429 seconds