nix-configs/nixos-modules/dhcp.nix
2024-12-29 19:11:48 -05:00

39 lines
835 B
Nix

{ config, lib, ... }:
{
options = {
mainInterface = lib.mkOption {
type = lib.types.str;
};
};
config = {
networking.firewall.allowedUDPPorts = [
67
68
];
systemd.network.networks.${config.mainInterface} = {
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"; } ];
};
};
}