How to Configure a Spoke¶
On a spoke, wgpathd steers the endpoint of each wg_mesh peer you give a relay endpoint and a tunnel address. This guide starts it in observe mode, where every managed peer is held on its relay endpoint while wgpathd reports what it would do. Turning on steering is a separate step. To do it in the LuCI web interface instead, see How to configure mesh paths in LuCI.
Prerequisites¶
- wgpathd is installed: How to install wgpathd.
- The spoke's
wg_meshandwg_hubare set up as in How to prepare the WireGuard substrate. - Every spoke's firewall answers the others' tunnel probes and accepts relayed packets: How to open the firewall for wgpathd.
- The hub is configured: How to configure the hub.
1. Write the configuration¶
Replace the contents of /etc/config/wgpathd with:
config wgpathd 'main'
option enabled '1'
option role 'spoke'
option mesh_iface 'wg_mesh'
option hub_iface 'wg_hub'
option discovery 'http://10.10.0.1:7780/peers'
option mode 'observe'
config peer
option public_key 'SpokeBmeshPublicKeyExample00000000000000000='
option relay '10.10.0.12:51820'
option tunnel '10.20.0.12'
discovery is the hub's serve_addr and serve_port with the path /peers.
Add one peer section for each other spoke:
public_keyis that spoke's key, as in itswg_meshpeer section in/etc/config/network. Print it withuci get network.spoke_b.public_key.relayis that spoke's transit address plus itswg_meshlisten port.tunnelis its tunnel address, which must be in itsallowed_ips.
Give the hub peer no peer section: wgpathd leaves it alone, at the fixed endpoint of its endpoint_host. Another spoke's peer may have an endpoint_host too, a roamer's peer for an anchor for instance: its peer section makes wgpathd steer it all the same, in place of that fixed endpoint.
Every option is described in UCI configuration, and the peer section in Peer sections.
2. Check the configuration¶
service wgpathd check
ok config: spoke, mode observe, 1 steered peer, 1 not steered
ok wg_mesh: up, 2 peers
ok wg_hub: up, 1 peer
ok peer spoke_b: relay 10.10.0.12:51820 via wg_hub, probes 10.20.0.12
skip peer hub: not steered (fixed endpoint)
ok firewall: ICMP echo-request (tunnel probe) from wg_mesh (zone vpn): accepted
ok firewall: UDP port 51820 (relayed WireGuard) from wg_hub (zone vpn): accepted
ok firewall: ICMPv6 echo-request (underlay probe) from zone wan: accepted
There should be one ok peer line per other spoke, with its relay via wg_hub. The hub peer is always skip, with its fixed endpoint and no peer section. The firewall: lines say whether this spoke's firewall accepts what the other spokes send it; a warning comes with the rule to add (How to open the firewall for wgpathd). Fix every FAIL and warn line before you go on; Service commands explains each one, and Managed and unmanaged peers the peer reasons.
3. Start the service and check the relay path¶
service wgpathd start
service wgpathd status
Within a few seconds every managed peer is on its relay endpoint:
running
role: spoke (mode observe)
discovery: fresh (last success 2s ago)
peers:
spoke_b SpokeBme RELAY 10.10.0.12:51820 no change yet 0 switches
unmanaged:
hub HubMeshP fixed endpoint
Each peer should be in RELAY with its relay as the endpoint, and discovery should be fresh. The log has a matching started role=spoke mode=observe managed=1 unmanaged=1 line. If the first line is not running, look at logread -e wgpathd | tail -n 5 and find the code in Log messages.
Then prove the relay carries traffic, using the other spoke's tunnel address:
ping -c3 10.20.0.12
If this fails, the relay floor does not work yet, and there is no point in turning on steering. Check that the hub forwards the transit range, and that service wgpathd check on the other spoke shows its firewall accepting relayed packets and the tunnel probe.
4. Watch for readiness¶
Leave the spoke in observe mode for a while and watch ready and up_streak for each peer in ubus call wgpathd status. ready: true means the peer has enough direct evidence that steer mode would start a trial.
A peer that never becomes ready has no direct evidence. For an anchor, that is normal until the other side steers: its evidence is the other side's direct traffic. For a roamer, check that discovery.fresh is true and that the peer's IPv6 address answers ping -6.
When the relay works and peers become ready, continue with How to move a spoke from observe to steer.