No description
- Python 82.7%
- Jinja 17.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVUe4g65L7UnUVqHmQp7kG |
||
| .forgejo/workflows | ||
| changelogs | ||
| extensions/molecule | ||
| meta | ||
| plugins | ||
| roles | ||
| tests/unit/plugins/filter | ||
| .ansible-lint | ||
| .copier-answers.yml | ||
| .gitignore | ||
| .gitleaks.toml | ||
| .pre-commit-config.yaml | ||
| .yamllint | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| galaxy.yml | ||
| LICENSE | ||
| README.md | ||
| ruff.toml | ||
| SECURITY.md | ||
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
exposelist declares, frominternet,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/routedandextensions/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.