2023-07-28 09:59:47 +07:00
|
|
|
{ config
|
|
|
|
, router-lib
|
2023-08-13 18:08:34 +07:00
|
|
|
, lib
|
2023-07-28 09:59:47 +07:00
|
|
|
, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.router-settings;
|
|
|
|
netAddresses.lan4 = (router-lib.parseCidr cfg.network).address;
|
|
|
|
in {
|
|
|
|
services.prometheus.exporters = {
|
|
|
|
node = {
|
|
|
|
enable = true;
|
|
|
|
enabledCollectors = [ "logind" "systemd" ];
|
|
|
|
listenAddress = netAddresses.lan4;
|
|
|
|
port = 9101; # cups is 9100
|
|
|
|
};
|
|
|
|
process = {
|
|
|
|
enable = true;
|
|
|
|
listenAddress = netAddresses.lan4;
|
|
|
|
};
|
|
|
|
unbound = {
|
|
|
|
enable = true;
|
2024-11-24 11:21:02 +07:00
|
|
|
# controlInterface = "/run/unbound/unbound.ctl";
|
|
|
|
host = "unix:///run/unbound/unbound.ctl";
|
2023-07-28 09:59:47 +07:00
|
|
|
listenAddress = netAddresses.lan4;
|
|
|
|
group = config.services.unbound.group;
|
|
|
|
};
|
|
|
|
kea = {
|
|
|
|
enable = true;
|
|
|
|
controlSocketPaths = [
|
2023-08-13 18:08:34 +07:00
|
|
|
config.router.interfaces.br0.ipv4.kea.settings.control-socket.socket-name
|
|
|
|
config.router.interfaces.br0.ipv6.kea.settings.control-socket.socket-name
|
2023-07-28 09:59:47 +07:00
|
|
|
];
|
|
|
|
listenAddress = netAddresses.lan4;
|
|
|
|
};
|
2024-01-27 03:57:21 +07:00
|
|
|
ping2 = {
|
2023-12-15 06:03:46 +07:00
|
|
|
enable = true;
|
|
|
|
listenAddress = netAddresses.lan4;
|
|
|
|
port = 9380;
|
|
|
|
config = {
|
|
|
|
type = "raw";
|
|
|
|
targets = [
|
|
|
|
"8.8.8.8"
|
|
|
|
{ target = "8.8.8.8"; netns = "wan"; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-07-28 09:59:47 +07:00
|
|
|
};
|
2023-08-13 18:08:34 +07:00
|
|
|
router.interfaces.br0 = let
|
|
|
|
# all of this just to avoid logging commands...
|
|
|
|
keaLogs = v: [
|
|
|
|
"alloc-engine"
|
|
|
|
"auth"
|
|
|
|
"bad-packets"
|
|
|
|
"database"
|
|
|
|
"ddns"
|
|
|
|
"dhcp${toString v}"
|
|
|
|
"dhcpsrv"
|
|
|
|
"eval"
|
|
|
|
"hosts"
|
|
|
|
"leases"
|
|
|
|
"options"
|
|
|
|
"packets"
|
|
|
|
"tcp"
|
|
|
|
];
|
|
|
|
in {
|
|
|
|
ipv4.kea.settings = {
|
|
|
|
control-socket = {
|
2023-10-25 18:04:07 +07:00
|
|
|
socket-name = "/run/kea4-br0/kea.sock";
|
2023-08-13 18:08:34 +07:00
|
|
|
socket-type = "unix";
|
|
|
|
};
|
|
|
|
loggers = lib.toList {
|
|
|
|
name = "kea-dhcp4";
|
|
|
|
severity = "WARN";
|
|
|
|
output_options = [ { output = "syslog"; } ];
|
|
|
|
} ++ map (name: {
|
|
|
|
name = "kea-dhcp4.${name}";
|
|
|
|
severity = "INFO";
|
|
|
|
output_options = [ { output = "syslog"; } ];
|
|
|
|
}) (keaLogs 4);
|
2023-07-28 09:59:47 +07:00
|
|
|
};
|
2023-08-13 18:08:34 +07:00
|
|
|
ipv6.kea.settings = {
|
|
|
|
control-socket = {
|
2023-10-25 18:04:07 +07:00
|
|
|
socket-name = "/run/kea6-br0/kea.sock";
|
2023-08-13 18:08:34 +07:00
|
|
|
socket-type = "unix";
|
|
|
|
};
|
|
|
|
loggers = lib.toList {
|
|
|
|
name = "kea-dhcp6";
|
|
|
|
severity = "WARN";
|
|
|
|
output_options = [ { output = "syslog"; } ];
|
|
|
|
} ++ map (name: {
|
|
|
|
name = "kea-dhcp6.${name}";
|
|
|
|
severity = "INFO";
|
|
|
|
output_options = [ { output = "syslog"; } ];
|
|
|
|
}) (keaLogs 6);
|
2023-07-28 09:59:47 +07:00
|
|
|
};
|
|
|
|
ipv6.corerad.settings.debug = {
|
|
|
|
address = "${netAddresses.lan4}:9430";
|
|
|
|
prometheus = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.unbound.settings.server = {
|
|
|
|
extended-statistics = true;
|
|
|
|
};
|
|
|
|
}
|