wireguard client module for thinkpad

This commit is contained in:
Andrea Ciceri 2023-04-01 14:29:45 +02:00
parent 9f2dcb920e
commit 57f3d7645b
No known key found for this signature in database
5 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{config, ...}: {
networking.firewall = {
allowedUDPPorts = [51820]; # Clients and peers can use the same port, see listenport
};
# Enable WireGuard
networking.wireguard.interfaces = {
# "wg0" is the network interface name. You can name the interface arbitrarily.
wg0 = {
ips = ["10.100.0.2/32"];
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
privateKeyFile = config.age.secrets."${config.networking.hostName}-wireguard-private-key".path;
peers = [
{
# Public key of the server (not a file path).
publicKey = "O9V2PI7+vZm7gGn3f9SaTsJbVe9urf/jZkdXFz/mjVU=";
# Forward all the traffic via VPN.
# allowedIPs = [ "0.0.0.0/0" ];
# Or forward only particular subnets
allowedIPs = ["10.100.0.1"];
# Set this to the server IP and port.
endpoint = "mothership.aciceri.dev:51820";
persistentKeepalive = 25;
}
];
};
};
}