2020-07-08 14:22:48 +00:00
|
|
|
{ lib, ... }:
|
2020-01-04 22:16:31 +00:00
|
|
|
|
2023-04-30 22:17:22 +00:00
|
|
|
let
|
|
|
|
unstable = import <nixos-unstable-small> { };
|
|
|
|
vars = import ./lib/vars.nix;
|
2020-01-04 22:16:31 +00:00
|
|
|
|
|
|
|
in {
|
|
|
|
services.corerad = {
|
|
|
|
enable = true;
|
2021-01-03 14:06:02 +00:00
|
|
|
|
2023-04-30 22:17:22 +00:00
|
|
|
# Enable as necessary to get development builds of CoreRAD.
|
|
|
|
package = unstable.corerad;
|
|
|
|
|
2020-06-14 17:53:48 +00:00
|
|
|
settings = with vars.interfaces; {
|
|
|
|
# Base non-interface configuration.
|
|
|
|
debug = {
|
|
|
|
# No risk exposing these off-host because of the WAN firewall.
|
|
|
|
address = ":9430";
|
|
|
|
prometheus = true;
|
|
|
|
pprof = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
interfaces =
|
|
|
|
# Upstream monitoring interfaces.
|
2023-09-15 19:12:31 +00:00
|
|
|
[{
|
|
|
|
# Spectrum, Metronet does not provide IPv6 as of September 2023.
|
|
|
|
names = [ "wan0" ];
|
2020-06-14 17:53:48 +00:00
|
|
|
monitor = true;
|
2023-09-15 19:12:31 +00:00
|
|
|
}]
|
2020-06-14 17:53:48 +00:00
|
|
|
|
|
|
|
# Downstream advertising interfaces.
|
2022-03-02 15:30:10 +00:00
|
|
|
++ lib.forEach [ mgmt0 lab0 lan0 guest0 iot0 ] (ifi:
|
2021-06-30 11:20:31 +00:00
|
|
|
{
|
|
|
|
name = ifi.name;
|
|
|
|
advertise = true;
|
|
|
|
|
|
|
|
# Configure a higher preference for interfaces with more bandwidth.
|
|
|
|
preference = ifi.preference;
|
|
|
|
|
|
|
|
# Advertise all /64 prefixes on the interface.
|
2022-02-01 02:23:06 +00:00
|
|
|
prefix = [ { } ];
|
2021-06-30 11:20:31 +00:00
|
|
|
|
|
|
|
# Automatically use the appropriate interface address as a DNS server.
|
2022-02-01 02:23:06 +00:00
|
|
|
rdnss = [ { } ];
|
2022-03-21 12:47:33 +00:00
|
|
|
|
|
|
|
# Automatically propagate routes owned by loopback.
|
|
|
|
route = [ { } ];
|
2021-06-30 11:20:31 +00:00
|
|
|
} // (
|
|
|
|
# Configure DNS search on some trusted LANs, or omit otherwise.
|
2022-03-10 14:17:58 +00:00
|
|
|
#
|
|
|
|
# TODO(mdlayher): probably rename to ifi.trusted.
|
2021-06-30 11:20:31 +00:00
|
|
|
if ifi.internal_dns then {
|
|
|
|
dnssl = [{ domain_names = [ vars.domain ]; }];
|
|
|
|
} else
|
|
|
|
{ }));
|
2020-06-14 17:53:48 +00:00
|
|
|
};
|
2020-01-04 22:16:31 +00:00
|
|
|
};
|
|
|
|
}
|