Experiment with Wireguard

This commit is contained in:
Bun 2025-04-16 20:40:55 -04:00
parent 3df764b525
commit 2db1711373
2 changed files with 13 additions and 18 deletions

View file

@ -1,19 +1,14 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
config = lib.mkIf config.services.wireguard.client.enable { networking.wg-quick.interfaces.wgc = lib.mkIf config.services.wireguard.client.enable {
networking = {
firewall.trustedInterfaces = [ "wgc" ];
wg-quick.interfaces.wgc = {
privateKey = config.secrets.wg.clientKey; privateKey = config.secrets.wg.clientKey;
peers = [ peers = [
{ # Kitty server { # Main home server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8="; publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ]; allowedIPs = [ "11.0.0.0/8" ];
endpoint = "sv.nixfox.ca:51820"; endpoint = "sv.nixfox.ca:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
]; ];
}; };
};
};
} }

View file

@ -10,17 +10,17 @@
}; };
wireguard.interfaces.wgs = { wireguard.interfaces.wgs = {
ips = [ "10.100.0.1/24" ]; ips = [ "11.0.0.1/8" ];
listenPort = 51820; listenPort = 51820;
privateKey = config.secrets.wg.serverKey; privateKey = config.secrets.wg.serverKey;
peers = [ peers = [
{ # NixOS Config Key { # NixOS Config Key
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0="; publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "10.100.0.16/28" ]; allowedIPs = [ "11.0.0.0/8" ];
} }
{ # Pixel 9 { # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4="; publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "10.100.0.2/32" ]; allowedIPs = [ "11.1.0.2/32" ];
} }
]; ];
}; };