os/hosts/pie/dhcpd.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

140 lines
3.1 KiB
Nix
Raw Normal View History

2023-09-11 21:51:13 +00:00
{ pkgs, adblock-unbound, ... }:
{
2023-11-08 17:52:09 +00:00
networking.firewall.allowedUDPPorts = [ 67 547 ];
networking.firewall.extraInputRules = ''
2023-11-13 14:48:05 +00:00
ip6 daddr ff02::1:2/128 udp dport 547 accept comment "DHCPv6 server"
2023-11-08 17:52:09 +00:00
'';
2023-09-12 08:25:55 +00:00
2023-09-11 21:51:13 +00:00
services.kea.dhcp4 = {
enable = true;
2023-09-11 21:51:13 +00:00
settings = {
interfaces-config = {
2023-09-12 08:25:55 +00:00
dhcp-socket-type = "raw";
2023-09-11 21:51:13 +00:00
interfaces = [
"enabcm6e4ei0"
];
};
lease-database = {
name = "/var/lib/kea/dhcp4.leases";
persist = true;
type = "memfile";
};
rebind-timer = 2000;
renew-timer = 1000;
valid-lifetime = 4000;
subnet4 = [
{
subnet = "192.168.178.0/24";
pools = [
{ pool = "192.168.178.2 - 192.168.178.255"; }
];
option-data = [
{
name = "domain-name-servers";
space = "dhcp4";
csv-format = true;
data = "192.168.178.2";
always-send = true;
}
{
name = "routers";
data = "192.168.178.1";
always-send = true;
}
];
reservations = [
# Pie should set ip itself
2023-09-11 21:51:13 +00:00
{
hw-address = "08:f1:ea:97:0f:0c";
2023-09-11 21:51:13 +00:00
ip-address = "192.168.178.3";
}
{
2023-10-19 18:55:56 +00:00
hw-address = "b8:76:3f:64:a3:64";
ip-address = "192.168.178.4";
}
{
2023-11-08 17:52:09 +00:00
hw-address = "04:d9:f5:fa:35:f5";
ip-address = "192.168.178.5";
}
{
hw-address = "48:a4:72:1d:29:32";
ip-address = "192.168.178.6";
}
2023-09-11 21:51:13 +00:00
];
}
];
};
};
services.kea.dhcp6 = {
enable = true;
settings = {
interfaces-config = {
interfaces = [
"enabcm6e4ei0"
];
};
2023-09-11 21:51:13 +00:00
lease-database = {
name = "/var/lib/kea/dhcp6.leases";
persist = true;
type = "memfile";
};
rebind-timer = 2000;
renew-timer = 1000;
valid-lifetime = 4000;
subnet6 = [
{
2023-11-05 19:45:40 +00:00
subnet = "2a02:908:5b1:e3c0::/64";
pools = [
2023-11-08 17:52:09 +00:00
{ pool = "2a02:908:5b1:e3c0::/72"; }
];
2023-11-08 17:52:09 +00:00
ddns-qualifying-suffix = "local.";
option-data = [
{
name = "dns-servers";
data = "2a02:908:5b1:e3c0:2::";
}
2023-11-08 17:52:09 +00:00
{
name = "domain-search";
data = "local";
}
];
reservations = [
{
hw-address = "08:f1:ea:97:0f:0c";
ip-addresses = [
"2a02:908:5b1:e3c0:3::"
];
}
{
2023-11-08 17:52:09 +00:00
hw-address = "04:d9:f5:fa:35:f5";
ip-addresses = [
"2a02:908:5b1:e3c0:5::"
];
}
{
hw-address = "48:a4:72:1d:29:32";
ip-addresses = [
"2a02:908:5b1:e3c0:6::"
2023-10-19 22:37:08 +00:00
];
}
];
}
];
2023-09-11 21:51:13 +00:00
};
};
}