Fix wireguard

This commit is contained in:
mups 2024-08-27 22:16:28 +00:00
parent ea08e19912
commit 63331ab3f8
2 changed files with 18 additions and 18 deletions

View file

@ -32,6 +32,8 @@ in {
mods.server.media.enable = true; mods.server.media.enable = true;
mods.server.wireguard.enable = true;
# Use the GRUB 2 boot loader. # Use the GRUB 2 boot loader.
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";

View file

@ -23,26 +23,24 @@
}; };
networking = lib.mkIf config.mods.wireguard.enable { networking.firewall = lib.mkIf config.mods.wireguard.enable {
firewall = { allowedUDPPorts = [ 51820 ]; # Clients and peers can use the same port, see listenport
allowedUDPPorts = [ 51820 ]; # Clients and peers can use the same port, see listenport };
}; networking.wireguard.interfaces = lib.mkIf config.mods.wireguard.enable {
wireguard.interfaces = { wg0 = {
wg0 = { ips = [ "10.100.0.2/24" ];
ips = [ "10.100.0.2/24" ]; listenPort = 51820;
listenPort = 51820;
privateKeyFile = "/home/muon/wireguard-keys/private"; privateKeyFile = "/home/muon/wireguard-keys/private";
peers = [ peers = [
{ {
publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA="; publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA=";
allowedIPs = [ "0.0.0.0/0" ]; allowedIPs = [ "0.0.0.0/0" ];
endpoint = "{server ip}:51820"; endpoint = "{server ip}:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
]; ];
};
}; };
}; };