1.1 KiB
1.1 KiB
Playbook: Add WireGuard Peer (Friend or Guest)
When to use
- Adding a new WireGuard peer in the friends (10.8.0.0/24) or guests (10.9.0.0/24) subnet.
- Updating firewall rules to allow access to specific ports for that peer.
Inputs
- Peer name (e.g.,
friend5,guest2) - Peer public key (WireGuard)
- Peer IP address (e.g.,
10.8.0.6or10.9.0.3) - Access scope (ports/services the peer should reach)
Steps
- Add the peer IP to
my.ipsinmodules/modules.nix. - Add the peer to the VPS WireGuard peers list in
modules/services/wireguard.nix. - If the peer is a guest/friend, ensure
allowedIPsincludes the relevant subnets inhosts/server/configuration.nix. - Add or adjust VPS firewall rules in
hosts/vps/configuration.nix(networking.firewall.extraForwardRules) to allow the requested ports. - Rebuild both hosts:
nixos-rebuild switch --flake .#vpsnixos-rebuild switch --flake .#server
Verification
- On VPS:
sudo wg show - On VPS:
sudo nft list ruleset | rg -n "<peer ip>|<port>" - From peer: confirm access to allowed endpoints (HTTP/TCP/ICMP as defined).