nix-configs/nixos-modules/dhcp.nix

40 lines
847 B
Nix
Raw Permalink Normal View History

2024-12-29 18:59:34 -05:00
{ config, lib, ... }:
{
options = {
2024-12-31 13:28:56 -05:00
mainInterfaceConfig = lib.mkOption {
2024-12-29 18:59:34 -05:00
type = lib.types.str;
};
};
config = {
networking.firewall.allowedUDPPorts = [
67
68
];
2024-12-31 13:28:56 -05:00
systemd.network.networks.${config.mainInterfaceConfig} = {
2024-12-29 18:59:34 -05:00
networkConfig = {
DHCPServer = true;
IPv6SendRA = true;
};
dhcpServerConfig = {
EmitDNS = true;
PoolSize = 50;
DNS = [
"10.42.69.2"
"10.42.69.100"
];
EmitRouter = true;
Router = "10.42.69.1";
SendOption = [
"15:string:icanttype.org"
"119:string:icanttype.org"
];
};
ipv6SendRAConfig = {
RouterLifetimeSec = 0;
EmitDNS = false;
};
ipv6Prefixes = [ { Prefix = "fd72:3dd5:21ae:3c97::/64"; } ];
};
};
}