nix-config/hosts/cloud/networking.nix

47 lines
1.1 KiB
Nix
Raw Normal View History

2025-01-11 18:54:58 +01:00
{ lib, config, ... }:
2025-01-11 03:55:19 +01:00
{
2025-01-04 18:24:41 +00:00
networking.dhcpcd.enable = false;
2025-01-11 17:44:35 +00:00
networking.firewall.enable = true;
# TODO: configure automatically in the module
2025-01-11 18:54:58 +01:00
networking.firewall.allowedUDPPorts =
let
wg-nets = lib.filter (net: net.hosts.cloud.endpoint.enable) config.oxalab.wg;
wg-ports = map (net: net.hosts.cloud.endpoint.port) wg-nets;
in
wg-ports;
2025-01-11 17:44:35 +00:00
2025-01-04 18:24:41 +00:00
networking.useNetworkd = true;
systemd.network.enable = true;
systemd.network = {
networks."30-uplink" = {
2025-01-11 03:55:19 +01:00
matchConfig.Name = "enp1s0";
2025-01-04 18:24:41 +00:00
networkConfig = {
Address = [
"188.245.196.27/32"
2025-02-03 17:12:11 +00:00
"116.202.5.66/32"
2025-01-04 18:24:41 +00:00
"2a01:4f8:c17:7f8a::1/64"
2025-02-03 17:12:11 +00:00
"2a01:4f8:c17:7f8a::617/64"
2025-01-02 18:23:46 +00:00
];
2025-01-04 18:24:41 +00:00
DNS = [
"2a01:4ff:ff00::add:1"
"2a01:4ff:ff00::add:2"
"185.12.64.1"
2025-01-02 18:23:46 +00:00
];
};
2025-01-04 18:24:41 +00:00
routes = [
{
Gateway = "172.31.1.1";
GatewayOnLink = true;
Destination = "0.0.0.0/0";
}
{
Gateway = "fe80::1";
GatewayOnLink = true;
Destination = "::/0";
}
];
2025-01-02 18:23:46 +00:00
};
};
}