Skip to content

Mesh Networking

Overview

Durantic provides mesh networks that connect your machines across different physical locations, data centers, and network environments. Traffic between machines travels over WireGuard, which is encrypted, or over Geneve, which is plaintext and is used only between machines that share a private network path. See Tunnel Types.

Mesh networks let machines communicate as if they were on the same local network, regardless of where they are physically located — behind NAT, in different cloud providers, or in on-premises data centers.

The underlying network the tunnels run over must be IPv4; IPv6 is not supported there. Machines reach each other over IPv4, directly or through another machine in the mesh. Mesh addresses are IPv4 as well.

Mesh networks list

How It Works

Setting up a mesh network follows a straightforward process:

  1. Create a mesh — Define a new mesh network in the dashboard and assign it a CIDR block (for example, 10.100.0.0/24).
  2. Assign machines — Add machines to the mesh. Each machine automatically receives an IP address from the CIDR block.
  3. Automatic tunnel setup — The agent on each machine configures its mesh interfaces and establishes tunnels to all other machines in the mesh: WireGuard (encrypted) or Geneve (plaintext, private paths only), according to the machines' tunnel types.
  4. NAT traversal — The agent handles endpoint discovery and NAT traversal automatically, finding the best path between peers.

No manual WireGuard configuration is required. The control plane distributes peer information and the agents handle all tunnel setup, key exchange, and keepalive management.

Tunnel Types

Tunnel type is set per machine (tunnel_type, on the machine's Network settings). Durantic has two data planes:

  • WireGuard — encrypted. Works across NAT and the public internet.
  • Geneve — a low-overhead overlay that is plaintext by design. Durantic uses it only between two machines that share a private network path, such as a private LAN or the inside of a datacentre.
Tunnel type Meaning
auto (default) Geneve with peers on a shared private path, WireGuard with every other peer.
wireguard WireGuard with every peer.
geneve Geneve where the path to a peer is private, WireGuard otherwise. The control plane serves an explicit geneve machine exactly as auto.

The tunnel used between two machines is resolved from both machines' settings:

Machine A Machine B Tunnel between them
wireguard wireguard or auto WireGuard
auto or geneve auto or geneve Geneve on a shared private path, WireGuard otherwise
wireguard geneve None. This is a configuration mistake (see below).

A shared private path means that one machine has an interface on a private (RFC 1918) IPv4 subnet that contains the other machine's address. Machines in the same datacentre that sit on different, routed private subnets use WireGuard.

Mesh traffic is encrypted only on WireGuard paths. With auto or geneve, traffic between machines on the same private network travels over Geneve in plaintext. If traffic must be encrypted on every path, set the tunnel type to wireguard.

wireguard + geneve is a mistake. The two machines share no data plane, so they get no tunnel to each other. The control plane still saves the change, but it logs a warning and exports the gauge durantic_mesh_incompatible_tunnel_pairs{reason="incompatible_types"}, which is 0 when the mesh is healthy.

How auto chooses between Geneve and WireGuard

A shared private path makes a pair eligible for Geneve, but it does not put the pair on Geneve by itself. Each agent also probes the peer's Geneve port (UDP 6081 by default) and keeps the peer on Geneve only while those probes are answered. Otherwise the pair uses WireGuard.

When the peer advertises over gossip that it answers them, and this agent's own responder is running, the probe is a DURP request carried inside a real Geneve packet. It crosses both machines' host firewalls in both directions, exactly as Geneve data does. So a host firewall (iptables/nftables) that drops UDP 6081 on either machine, inbound or outbound, fails the probe for both sides, and both sides move to WireGuard together. When the rule is removed, both sides return to Geneve. A cloud security group or network ACL that blocks UDP 6081 has the same effect.

Measured on test setups, with a host firewall rule added and later removed on one side:

Event Measured Bound the tests assert
Both sides on WireGuard after the rule is added about 37 s 42 s
Both sides back on Geneve after the rule is removed about 28 s 40 s

These are test-setup measurements, not guarantees. A pair whose Geneve path keeps failing waits longer before each return to Geneve, so a flapping path stops moving the pair.

Where a one-sided firewall can still split a pair. Toward a peer whose capability it has not seen in gossip, the agent uses a plain DURP probe instead. That probe is answered before the peer's host firewall, so it detects only a drop in the prober's own outbound rules. A firewall on one side can then leave one side on WireGuard and the other on Geneve, and traffic between them can be lost until the rule is removed. This applies:

  • to pairs with a peer that has gossip disabled (gossip_enabled off);
  • to an agent that starts while it is already partitioned from a peer, until gossip reaches that peer.

How to spot it. When the Geneve-encapsulated probe goes unanswered while DURP to the same address and port is healthy, the agent logs this WARN, at most once per peer every 10 minutes, with the peer's underlay address and port as underlay:

Geneve probe unanswered while DURP to the same port is healthy: a host firewall on either machine drops UDP to the Geneve port. The pair leaves Geneve; each side's active tunnel type for the other shows in the pair's peer stats

Each side reports the tunnel type it uses toward the other. The pair's peer stats, GET /api/connectivity/peer-stats/{machine_uuid_1}/{machine_uuid_2}, show both directions as left_to_right.active_tunnel_type and right_to_left.active_tunnel_type (left is the machine with the smaller UUID). The two values differ while a pair is split. GET /api/provisioning/machines/{machine_uuid}/peers shows one machine's view of every peer, and the agent exports durantic_mesh_peer_tunnel_type (see Monitoring).

Firewall requirement. Between machines whose tunnel type is auto (or geneve) and that share a private path, allow UDP 6081 in both directions, inbound and outbound, on both machines. If you cannot, set tunnel_type to wireguard on those machines.

Changing a machine's tunnel type

  • Do not change tunnel types in a mesh until every agent in that mesh runs a release with the tunnel-switch fixes.
  • A direct wireguard ↔ geneve change causes a brief cut on the pairs that switch. The cut is bounded by the time both agents take to apply their new configuration, and it fails closed. To avoid the wireguard + geneve mismatch in between, change through auto: wireguard → auto → geneve.
  • Existing geneve machines take one dataplane transition when the control plane is upgraded to the release in which geneve means "Geneve on private paths, WireGuard otherwise". On its first configuration after the upgrade, the agent brings up WireGuard next to Geneve. Peers on a shared private path stay on Geneve. Peers without one, which previously used Geneve over a non-private path, move to WireGuard.

Kubernetes pod traffic (official k3s and RKE2 roles)

The official k3s and RKE2 roles run the pod overlay (Flannel VXLAN; Canal on RKE2) over the mesh interface durantic-wg:

  • The pod overlay MTU is 1350 outer (VXLAN) and 1300 for pods.
  • On RKE2, Canal is bound to durantic-wg.
  • TSO and GSO are turned off on Flannel's VXLAN device.
  • Pod traffic is encrypted only on WireGuard paths. Where the mesh hop between two nodes is Geneve, pod traffic is plaintext.

Clusters provisioned before these settings do not pick them up by themselves. Rebuilding each node onto the current roles applies all of them. To update a cluster in place instead:

k3s, per node:

  1. Add /etc/rancher/k3s/flannel-net-conf.json (flannel "MTU": 1350, Network equal to the servers' cluster-cidr) and point flannel-conf at it in /etc/rancher/k3s/config.yaml. On servers, also state cluster-cidr: "10.42.0.0/16".
  2. kubectl drain <node> --ignore-daemonsets --delete-emptydir-data.
  3. Run k3s-killall.sh, then systemctl start k3s (or k3s-agent), or reboot the node. An MTU-only change does not resize an existing flannel.1, so this step is required.
  4. kubectl uncordon <node>.
  5. Delete any non-hostNetwork pod on the node that was created before the change.
  6. Verify: kubectl exec <pod> -- cat /sys/class/net/eth0/mtu reads 1300 for a pod on that node, and ip link show flannel.1 reads mtu 1300.

RKE2:

  1. On one server, add a HelmChartConfig for rke2-canal at /var/lib/rancher/rke2/server/manifests/rke2-canal-config.yaml (or kubectl apply it) that sets flannel.iface: durantic-wg, calico.ipAutoDetectionMethod: interface=durantic-wg, flannel.mtu: 1350 and calico.vethuMTU: 1300. RKE2 applies it cluster-wide, and every node's flannel restarts.
  2. Per node: kubectl drain <node> --ignore-daemonsets --delete-emptydir-data, run rke2-killall.sh and reboot, then kubectl uncordon <node>. Delete any non-hostNetwork pod still created before the change, and verify the pod and flannel.1 MTU read 1300 as for k3s.
  3. Treat the roll as a maintenance window: expect brief pod-traffic drops while each node's flannel restarts.

Both: to turn off TSO/GSO, write /etc/udev/rules.d/90-flannel-vxlan-offload.rules (mode 0644) on each node:

ACTION=="add", SUBSYSTEM=="net", KERNEL=="flannel.[0-9]*|flannel-v6.[0-9]*", ENV{ID_NET_DRIVER}=="vxlan", RUN+="/usr/sbin/ethtool -K %k tso off gso off"

Then run ethtool -K flannel.1 tso off gso off once.

Binding the pod overlay to durantic-wg routes pod traffic into the mesh, but it does not encrypt it by itself. Between nodes whose mesh hop is Geneve (auto or geneve on a private path), pod traffic is plaintext. Set the nodes' tunnel type to wireguard if pod traffic must be encrypted on every path.

IP Allocation

When a machine joins a mesh network, Durantic automatically allocates an IP address from the mesh's CIDR block. You can view a machine's mesh IP on its Network tab.

Machine network tab

IP addresses are stable — a machine keeps the same mesh IP as long as it remains in the mesh. If a machine is removed and later re-added, it may receive a different address.

Monitoring Mesh Health

Durantic provides detailed visibility into mesh network status through two tabs on each machine's detail page.

Peers Tab

The Peers tab shows the connectivity status between the current machine and every other machine in the mesh.

Machine peers

For each peer, you can see:

Field Description
Connectivity status Whether the peer is reachable
Path type Direct, transit (relayed through another machine in the mesh), or unknown when the peer has neither
Handshake age Time since the last successful WireGuard handshake
BGP state The BGP session state with this peer (if applicable)

Each peer row is expandable to reveal detailed metrics including latency, packet loss, and throughput statistics.

Endpoints Tab

The Endpoints tab shows how the machine is discovered by and reachable to other peers.

Machine endpoints

Endpoint types include:

Type Description
STUN Public endpoint discovered via STUN servers
Peer-observed Endpoint as seen by other machines in the mesh
Mesh-observed Endpoint detected through mesh network traffic

NAT Traversal

The Durantic agent handles NAT traversal automatically so machines behind firewalls and NAT devices can participate in the mesh without manual port forwarding.

The NAT traversal process includes:

  • STUN endpoint discovery — The agent queries STUN servers to determine its public IP address and port mapping. STUN probing can be enabled or disabled per machine via the stun_enabled setting.
  • Peer-observed endpoint sharing — Machines share the endpoints they observe for each other through the control plane, enabling connections even when STUN alone is insufficient.
  • Keepalive — A WireGuard tunnel sends a keepalive after 25 seconds without other traffic, which keeps NAT mappings open on established connections.
  • Gossip protocol — A SWIM-based memberlist protocol detects failed machines and propagates endpoint changes and VIP health quickly across the mesh. Gossip can be enabled or disabled per machine via the gossip_enabled setting.

This approach works behind most NAT types, including symmetric NAT in many cases.

Connectors

Connectors are reserved for future mesh participants that are not machines, such as Kubernetes CAPI controllers, CI runners, or external services.

Connectors are not usable yet. A connector is never configured: it has no WireGuard tunnel to the mesh, it receives no configuration, and machines never see it as a peer. It does still take up room in its mesh network: it reserves a mesh IP address, counts toward the network's peer limit, and, if marked as a gateway, counts toward the limit of 8 gateways. Adding, changing or removing a connector also makes the machines in its mesh network refresh their configuration. To connect a workload to the mesh today, run it on a machine.

Gateway Nodes

You can designate machines as gateway nodes to route traffic between the mesh networks of an account. A gateway belongs to one mesh, like every machine. Besides the machines of its own mesh, it peers with the gateways of the account's other mesh networks and exchanges routes with them over eBGP (External Border Gateway Protocol; each mesh has its own AS number). Traffic between two meshes flows through their gateways.

This is useful when you have separate mesh networks for different environments or teams but need controlled connectivity between them.

A mesh network can have at most 8 gateways, machines and connectors together, because routers balance traffic over at most 8 equal-cost paths. Making a ninth machine a gateway, or moving a gateway into a mesh that already has 8, is refused with an error on is_gateway.

For details on load balancing and route distribution, see Load Balancing.

Route Reflector Mode

By default every machine in a mesh opens a BGP session to every other machine. Route reflector mode is a setting of the mesh network. When it is on, the mesh's gateway nodes act as BGP route reflectors: every other machine opens BGP sessions only to the gateways, and the gateways pass each machine's routes on to all the others. This reduces the number of BGP sessions from O(n²) to O(n). The tunnels between machines are unchanged; only the BGP sessions are.

If route reflector mode is on and the mesh has no gateway, the machines fall back to BGP sessions with every other machine.