Add wg-quick

This commit is contained in:
muon 2024-08-27 23:15:09 +00:00
parent 196b50c629
commit 5172f21a54
2 changed files with 92 additions and 26 deletions

View file

@ -22,21 +22,20 @@
remote.config = ''config ${config.mods.openvpn.config}'';
};
networking.firewall = lib.mkIf config.mods.wireguard.enable {
allowedUDPPorts = [ 51820 ]; # Clients and peers can use the same port, see listenport
};
networking.wireguard.interfaces = lib.mkIf config.mods.wireguard.enable {
networking.wg-quick.interfaces = lib.mkIf config.mods.wireguard.enable {
wg0 = {
ips = [ "10.100.0.2/24" ];
listenPort = 51820;
address = [ "10.0.0.2/24" "fdc9:281f:04d7:9ee9::2/64" ];
dns = [ "10.0.0.1" "fdc9:281f:04d7:9ee9::1" ];
privateKeyFile = "/home/muon/wireguard-keys/private";
peers = [
{
publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA=";
allowedIPs = [ "0.0.0.0/0" ];
presharedKeyFile = "/home/muon/wireguard-keys/psk-muon";
allowedIPs = [ "0.0.0.0/0" "::/0" ];
# ip route add 93.95.230.11 via 192.168.0.1
endpoint = "93.95.230.11:51820";
persistentKeepalive = 25;
@ -45,5 +44,24 @@
};
};
# networking.wireguard.interfaces = lib.mkIf config.mods.wireguard.enable {
# wg0 = {
# ips = [ "10.100.0.2/24" ];
# listenPort = 51820;
# privateKeyFile = "/home/muon/wireguard-keys/private";
# peers = [
# {
# publicKey = "2RF8GmTZwQdzVm2l2piYy6U0qiMU3wSxC7Lt8urAjwA=";
# allowedIPs = [ "0.0.0.0/0" ];
# # ip route add 93.95.230.11 via 192.168.0.1
# endpoint = "93.95.230.11:51820";
# persistentKeepalive = 25;
# }
# ];
# };
# };
};
}