2023-09-19 13:47:08 +02:00
|
|
|
{ config, lib, ... }:
|
2023-04-12 17:21:24 +02:00
|
|
|
{
|
2023-07-30 19:41:51 +02:00
|
|
|
sops.secrets = {
|
|
|
|
"wireguard/dorm/private" = {
|
|
|
|
owner = config.users.users.systemd-network.name;
|
|
|
|
};
|
|
|
|
"wireguard/dorm/preshared" = {
|
|
|
|
owner = config.users.users.systemd-network.name;
|
|
|
|
};
|
|
|
|
};
|
2023-04-12 17:21:24 +02:00
|
|
|
networking = {
|
2023-04-12 17:28:41 +02:00
|
|
|
hostName = "falkenstein-1";
|
2023-09-19 13:47:08 +02:00
|
|
|
domain = "rfive.de";
|
2023-04-12 17:21:24 +02:00
|
|
|
useNetworkd = true;
|
|
|
|
enableIPv6 = true;
|
|
|
|
};
|
2023-09-29 10:32:24 +02:00
|
|
|
services.resolved = {
|
|
|
|
dnssec = "true";
|
|
|
|
fallbackDns = [
|
|
|
|
"9.9.9.9"
|
|
|
|
"149.112.112.112"
|
|
|
|
"2620:fe::fe"
|
|
|
|
"2620:fe::9"
|
|
|
|
];
|
|
|
|
};
|
2023-04-12 17:21:24 +02:00
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
|
|
|
networks."10-loopback" = {
|
|
|
|
matchConfig.Name = "lo";
|
|
|
|
linkConfig.RequiredForOnline = false;
|
|
|
|
};
|
|
|
|
networks."10-wired" = {
|
|
|
|
matchConfig.Name = "ens3";
|
|
|
|
networkConfig = {
|
2023-05-30 13:45:51 +02:00
|
|
|
DHCP = "ipv4";
|
2023-04-12 20:47:00 +02:00
|
|
|
IPv6AcceptRA = "yes";
|
2023-05-30 13:45:51 +02:00
|
|
|
Address = "2a01:4f8:c012:49de::1/64";
|
|
|
|
Gateway = "fe80::1";
|
2023-04-12 17:21:24 +02:00
|
|
|
};
|
|
|
|
};
|
2023-07-30 19:41:51 +02:00
|
|
|
|
|
|
|
netdevs."30-dorm" = {
|
|
|
|
netdevConfig = {
|
|
|
|
Kind = "wireguard";
|
2023-10-22 15:45:30 +02:00
|
|
|
Name = "wg0";
|
2023-07-30 19:41:51 +02:00
|
|
|
};
|
|
|
|
wireguardConfig = {
|
|
|
|
PrivateKeyFile = config.sops.secrets."wireguard/dorm/private".path;
|
|
|
|
ListenPort = 51820;
|
|
|
|
};
|
|
|
|
wireguardPeers = [
|
|
|
|
{
|
|
|
|
wireguardPeerConfig = {
|
2023-10-22 15:45:30 +02:00
|
|
|
PublicKey = "Z5lwwHTCDr6OF4lfaCdSHNveunOn4RzuOQeyB+El9mQ=";
|
2023-07-30 19:41:51 +02:00
|
|
|
PresharedKeyFile = config.sops.secrets."wireguard/dorm/preshared".path;
|
|
|
|
Endpoint = "dorm.vpn.rfive.de:51820";
|
2023-10-22 15:45:30 +02:00
|
|
|
AllowedIPs = "192.168.42.0/24, 192.168.43.0/24";
|
2023-07-30 19:41:51 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
networks."30-dorm" = {
|
2023-10-22 15:45:30 +02:00
|
|
|
matchConfig.Name = "wg0";
|
2023-07-30 19:41:51 +02:00
|
|
|
networkConfig = {
|
2023-10-22 15:45:30 +02:00
|
|
|
DNS = "192.168.42.1";
|
2023-07-30 19:41:51 +02:00
|
|
|
};
|
|
|
|
addresses = [
|
|
|
|
{
|
|
|
|
addressConfig = {
|
2023-10-22 15:45:30 +02:00
|
|
|
Address = "192.168.43.4/24";
|
2023-07-30 19:41:51 +02:00
|
|
|
RouteMetric = 30;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
routes = [
|
2023-10-22 15:45:30 +02:00
|
|
|
{ routeConfig = { Gateway = "0.0.0.0"; Destination = "192.168.42.0/24"; Metric = 30; }; }
|
2023-07-30 19:41:51 +02:00
|
|
|
];
|
|
|
|
};
|
2023-04-12 17:21:24 +02:00
|
|
|
};
|
|
|
|
}
|