wireguard: wg-home / wg-home-full profiles so home VPN coexists with NetBird (#41) #47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-41-wireguard-netbird-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements the plan approved in the thread (comment id 1042: "Looks perfect. Go ahead and push a pr"): two NetworkManager profiles per fully-managed client so wg-home can coexist with the work NetBird VPN.
lib/wireguard.nix— adds awgProfilestable and parameterizesmkNetworkManagerConfigby profile:home—allowed-ips=192.168.97.0/24,192.168.73.0/24,[ipv4] never-default=true,route-metric=40000,dns-priority=500(low precedence) — coexists with netbird.home-full— byte-for-byte today's full-tunnel behavior (0.0.0.0/0, gateway, VPN DNS precedence).interface-name=wg-home, so the server still sees one peer per host — zero server-side churn, same keypair.modules/wireguard-client.nix— renders both viasops.templatesinto/etc/NetworkManager/system-connections/(wg-home.nmconnection,wg-home-full.nmconnection), same 0600/owner/key handling as before.Hosts affected: kansas, pumpkin (
rpickler.vpn.enable = true). Server module, peer keys/rotation, and the manual app-script configs (mkClientConfig) are untouched.Verified (nix eval of the flake, both hosts)
home-fulloutput is identical to the pre-change config (modulo blank lines between sections, which NM's keyfile parser does not require). kansas, pumpkin and pi4 all still evaluate; template paths render towg-home.nmconnectionandwg-home-full.nmconnection.One refinement vs. the posted plan
The plan said "no DNS is pushed as default" for
home— this PR keepsdns=192.168.73.1on the link but atdns-priority=500. That's what makes*.vpnwork while netbird is up: systemd-resolved merges search domains across links regardless of priority (priority only orders which link handles non-matching names), so*.vpnqueries route to home dnsmasq via wg-home while netbird's link stays the default resolver for everything else. Removing DNS entirely (priority-1/empty) would have silently killed*.vpnresolution — the opposite of the goal.Usage after deploy (kansas)
nmcli con up wg-home→ internal ranges +*.vpnDNS with netbird still up.nmcli con up wg-home-full→ full tunnel; netbird off (two default-route providers never coexist — inherent, not a bug).interface-name=wg-home; if NM complains the device is busy when swapping profiles while the other is active,nmcli con down <other> && nmcli con up <new>.Caveats/rollback as posted in the issue: a plain revert removes the rendered connections on next switch.
Fixes #41