No description
  • Python 82.7%
  • Jinja 17.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
oliver.maklott 4a1ce8b8a8
All checks were successful
ci / build (push) Successful in 2s
ci / units (push) Successful in 3s
ci / sanity (push) Successful in 8s
ci / lint (push) Successful in 12s
ci / molecule (push) Successful in 16m38s
release / release (push) Successful in 2s
Release 0.7.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVUe4g65L7UnUVqHmQp7kG
2026-11-30 06:40:51 +00:00
.forgejo/workflows belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
changelogs Release 0.7.0 2026-11-30 06:40:51 +00:00
extensions/molecule belowtoxic.networking 0.6.0: a new WireGuard key on request 2026-11-29 21:56:52 +00:00
meta belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
plugins QC: one guest's egress no longer opens another's ports; key rotation guard 2026-11-30 05:31:37 +00:00
roles QC: one guest's egress no longer opens another's ports; key rotation guard 2026-11-30 05:31:37 +00:00
tests/unit/plugins/filter QC: one guest's egress no longer opens another's ports; key rotation guard 2026-11-30 05:31:37 +00:00
.ansible-lint belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
.copier-answers.yml belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
.gitignore belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
.gitleaks.toml belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
.pre-commit-config.yaml belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
.yamllint belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
CHANGELOG.md Release 0.7.0 2026-11-30 06:40:51 +00:00
CONTRIBUTING.md belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
galaxy.yml Release 0.7.0 2026-11-30 06:40:51 +00:00
LICENSE belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
README.md belowtoxic.networking 0.4.0: networks without forwarding, CoreDNS 2026-11-29 01:24:21 +00:00
ruff.toml belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00
SECURITY.md belowtoxic.networking 0.1.0: routed hypervisor networking 2026-11-22 21:23:42 +00:00

belowtoxic.networking

Hypervisor networking that makes guests reliably reachable over public IPv4 and IPv6 - and keeps everything else out.

  • One routed tap per guest (vm-<name>, fc-<name> for Firecracker), no shared guest bridge. Every tap carries the same gateway addresses (169.254.0.1, fe80::1), so a guest's network configuration does not depend on the host it runs on.
  • All Hetzner IPv4 models: additional single IPs and subnet addresses routed as /32, private addresses with masquerading and port forwards, and guests bridged with a virtual MAC. IPv6: one /128 per guest out of the host's /64.
  • Reachability is opt-in: a guest is reachable only on what its expose list declares, from internet, admin, guest:<name>, group:<tag> or a CIDR.
  • systemd-networkd and nftables, no dnsmasq, no ndppd, no libvirt hooks.
  • Dead-man switch: every change is rolled back automatically unless Ansible can still reach the host afterwards.
  • WireGuard admin network: a hub (the trust anchor) with sites (hypervisors, routing their guests) and clients (operator machines), as systemd-networkd netdevs - also on Flatcar, without Python.

Part of belowtoxic-ansible.

Content

Name Type Purpose
belowtoxic.networking.network_plan filter Robot facts + OpenBao intent → taps, routes, guest config, firewall rules; rejects addresses the host does not own
belowtoxic.networking.host_network role uplink bridge, taps, routes, proxy ARP/NDP (systemd-networkd)
belowtoxic.networking.nftables role host input filter and the guest rules of the plan
belowtoxic.networking.safe_apply role snapshot, rollback timer, confirmation
belowtoxic.networking.wireguard role WireGuard hub or spoke; keys generated on the host, live peer changes, no Python needed
belowtoxic.networking.wireguard_plan filter Network + member registry → peers, AllowedIPs, routes of one member; validates addresses, keys, routes
belowtoxic.networking.wireguard_client_config filter wg-quick configuration for an operator machine
belowtoxic.networking.caddy role Caddy as a pinned container: ACME (HTTP-01/TLS-ALPN-01), headers, forward auth for Authentik outposts; no Python needed
belowtoxic.networking.coredns role CoreDNS as a pinned container: an internal zone from records, bound to the WireGuard hub address only; no Python needed
belowtoxic.networking.netplan_configures test whether a netplan file configures an interface

Layout on a hypervisor

Hetzner router (192.0.2.1 / fe80::1)
   │
 uplink NIC ──► br-wan  MAC = NIC MAC; main IPv4 /32, <64>::2/128
                  │      guests with a virtual MAC are ports of br-wan
   host routes ▼ (forwarding, strict rp_filter, nftables)
 vm-web1   169.254.0.1/32 + fe80::1/64, routes 203.0.113.10/32 and <64>::10/128
 vm-app1   169.254.0.1/32 + fe80::1/64, route 10.200.0.20/32 (NAT, port forwards)
 fc-worker ...

Inside a routed guest: its address as /32 and /128, default routes via 169.254.0.1 and fe80::1 (on-link). The plan contains this configuration per guest (guests[].config); the virtualization roles render it into cloud-init or Ignition.

How Hetzner delivers the addresses

Per host (infra/hosts/<host> → network):

Setting routed (default) alternative
ipv6_mode the /64 is routed to the host ndp_proxy: the router asks for every address on the link; the host answers for its routed guests
ipv4_additional_mode single IPs are routed to the main IP proxy_arp: the host answers ARP for them

Find out with tcpdump -ni <uplink> 'arp or icmp6' while pinging an unused guest address from outside: requests for the address itself mean on-link.

Testing

  • Unit tests for the plan: every NIC mode, all address checks, the generated rules.
  • extensions/molecule/routed and extensions/molecule/onlink: a fake Hetzner router VM and a hypervisor VM with one network-namespace guest per kind (public, public-but-unexposed, additional IP, virtual MAC, NAT with port forward, internal without egress, micro-VM). 43 probes check inbound IPv4/IPv6, egress, spoofing, guest-to-guest rules and host SSH - after converge, after a reboot, and after a dead-man-switch rollback.

License

GPL-3.0-or-later, see LICENSE.