How to Configure the Hub¶
On the hub, wgpathd reads the wg_mesh peer table and publishes the spokes' IPv6 endpoints on its wg_hub address. It steers nothing.
Prerequisites¶
- wgpathd is installed: How to install wgpathd.
- The hub has
wg_meshandwg_hubas in How to prepare the WireGuard substrate, and spokes are handshaking onwg_mesh. - The hub's firewall accepts the spokes' peer list requests: How to open the firewall for wgpathd.
1. Write the configuration¶
Replace the contents of /etc/config/wgpathd with:
config wgpathd 'main'
option enabled '1'
option role 'hub'
option read_iface 'wg_mesh'
option serve_addr '10.10.0.1'
option serve_port '7780'
read_ifaceis the interface whose peer endpoints are published: the mesh, where the spokes' IPv6 endpoints appear.serve_addris the hub's own address onwg_hub. Spokes reach it through the tunnel that stays up when the mesh is down.serve_portis the TCP port of the list, the one the hub's firewall rule accepts from the zone ofwg_hub.
Every option is described in UCI configuration.
2. Check the configuration¶
service wgpathd check
ok config: hub, reads wg_mesh, serves 10.10.0.1:7780
ok wg_mesh: up, 2 peers
ok firewall: TCP port 7780 (peer list) from wg_hub (zone vpn): accepted
Fix every FAIL line before you go on. A warn firewall: line means the spokes cannot fetch the list yet; it comes with the rule to add. Each line is explained in Service commands.
3. Start the service¶
service wgpathd start
service wgpathd status
running
role: hub
published peers:
SpokeAme [2001:db8:a::1]:51820 handshake 12s ago
SpokeBme [2001:db8:b::20]:51820 handshake 7s ago
The log has a started role=hub line. If the first line is not running, or wgpathd: cannot read status follows it, look at logread -e wgpathd | tail -n 5 and find the code in Log messages. A common one is startup failed: PUBLISHER_LISTEN_FAILED (...: bind(): Address not available): serve_addr is not an address of this host, or wg_hub is not up.
4. Check what is published¶
Each spoke should be listed under published peers with a direct IPv6 endpoint. From a spoke, fetch the same data over wg_hub:
uclient-fetch -qO- http://10.10.0.1:7780/peers
A spoke missing from the list has no IPv6 endpoint in the hub's wg_mesh table. Check that spoke's wg_mesh peer for the hub has an IPv6 endpoint and persistent_keepalive.