Compare commits

...

2 commits

Author SHA1 Message Date
a373a0dc20
feat: use networkd for routing config
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
2025-09-11 10:30:20 +02:00
2c60a915eb
feat: use seperate routing table for wg
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
2025-09-11 01:27:09 +02:00

View file

@ -18,11 +18,47 @@
80 80
443 443
]; ];
allowedUDPPorts = [
51820
];
}; };
systemd.network.networks."30-wan".address = [ networking.iproute2.enable = true;
"2a01:4f8:c013:7fc0::/64" systemd.network.config = {
]; routeTables = {
vpn = 133;
};
addRouteTablesToIPRoute2 = true;
};
systemd.network.networks."30-wan" = {
address = [
"2a01:4f8:c013:7fc0::/64"
];
routingPolicyRules = [
{
From = "10.64.244.95/32";
Table = "vpn";
}
{
From = "fc00:bbbb:bbbb:bb01::1:f45e/128";
Table = "vpn";
}
{
User = config.users.users.vpn.uid;
Table = "vpn";
Family = "both";
}
];
};
users.groups.vpn = { };
users.users.vpn = {
isSystemUser = true;
group = "vpn";
uid = 51280;
};
networking.wireguard = { networking.wireguard = {
enable = true; enable = true;
@ -47,6 +83,7 @@
listenPort = 51820; listenPort = 51820;
privateKeyFile = config.sops.secrets.wireguardKey.path; privateKeyFile = config.sops.secrets.wireguardKey.path;
table = "133";
}; };
}; };