Skip to content

Knoten_with_embedded_WireGuard

Pre-release
Pre-release

Choose a tag to compare

@Yacin1102 Yacin1102 released this 03 Nov 15:43
· 20 commits to main since this release
a049593

WireGuard now runs inside meshd

meshd no longer writes a WireGuard config file and shells out to wg and wg-quick. It now embeds wireguard-go and runs the tunnel itself, creating the knoten-wg interface through /dev/net/tun and netlink.

  • No WireGuard install needed. The kernel module and wireguard-tools are no longer required on nodes.
  • Live, minimal updates. Each sync compares the new peer list with what the tunnel already has and sends only the difference. The log shows what changed: synced knoten-wg: 2 added, 0 updated, 0 removed.
  • wg show still works. meshd opens the standard control socket at /var/run/wireguard/knoten-wg.sock, so sudo wg show knoten-wg works if you have wireguard-tools installed.
  • Self-healing tunnel. If the interface or its socket is removed while meshd runs, meshd creates it again (coordinated mode).

Behavior changes

  • The tunnel lives as long as meshd. Stopping meshd removes the tunnel; starting it brings it back. Run meshd as a service (for example systemd with Restart=always).
  • Standalone mode keeps running. It used to write the config and exit; it now brings the tunnel up and stays running. Restart meshd after editing the peer list.
  • -setup only writes the config. It no longer performs a register-and-sync cycle. Start meshd afterwards.
  • -once was removed.
  • SIGINT / SIGTERM remove the tunnel. Before, they left it up.
  • New addresses start at 10.10.0.3. The coordination server now keeps the first two addresses of the range back. Machines that are already enrolled keep their address.

Upgrading from v0.2.0-alpha

  • Your identity is kept. Existing configs already point to /var/lib/knoten/meshd-state.json through state_path. Only new setups use the new default path, /var/lib/knoten/meshd-State_file.json.
  • /etc/wireguard/knoten-wg.conf is no longer used. Bring the old tunnel down once (sudo wg-quick down knoten-wg), then delete the file.
  • mtu is now a number. If you set it by hand as a string ("mtu": "1420"), change it to "mtu": 1420.
  • dns is no longer used and is ignored.

Under the hood

  • Addresses, ranges and endpoints are parsed with net/netip, for stricter validation in setup, the config and the coordination server.
  • New dependencies: golang.zx2c4.com/wireguard and github.com/vishvananda/netlink. Both binaries are still static Go builds.

Known limitation

meshd does not remember its peers yet. Every restart builds the tunnel with no peers until the next successful sync. If the coordination server is unreachable at that moment, the node stays cut off until it comes back. The next release adds peer memory and merges standalone and coordinated mode into one configuration file.