Switch to systemd-networkd
This commit is contained in:
parent
10b0840daa
commit
c3a30aabab
1 changed files with 27 additions and 25 deletions
|
@ -133,36 +133,38 @@ in
|
||||||
}) cfg.admin_accounts;
|
}) cfg.admin_accounts;
|
||||||
|
|
||||||
# Configure network interfaces
|
# Configure network interfaces
|
||||||
networking.interfaces =
|
networking.useDHCP = false;
|
||||||
let ip4config = {
|
networking.useNetworkd = true;
|
||||||
useDHCP = false;
|
systemd.network.networks = {
|
||||||
ipv4.addresses = [
|
"10-uplink" = {
|
||||||
{
|
matchConfig = {
|
||||||
address = cfg.lan_ip;
|
# We could preprend "en* eth*" to match all ethernet interfaces
|
||||||
prefixLength = cfg.lan_ip_prefix_length;
|
Name = "${cfg.network_interface}";
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
ip6config = {
|
networkConfig = {
|
||||||
tempAddress = "disabled";
|
IPv6AcceptRA = false;
|
||||||
ipv6.addresses = [
|
LinkLocalAddressing = "no";
|
||||||
|
};
|
||||||
|
address = [
|
||||||
|
"${cfg.lan_ip}/${toString cfg.lan_ip_prefix_length}"
|
||||||
|
"${cfg.ipv6}/${toString cfg.ipv6_prefix_length}"
|
||||||
|
];
|
||||||
|
routes = [
|
||||||
{
|
{
|
||||||
address = cfg.ipv6;
|
routeConfig = {
|
||||||
prefixLength = cfg.ipv6_prefix_length;
|
Gateway = cfg.lan_default_gateway;
|
||||||
|
# GatewayOnLink - Takes a boolean. If set to true, the kernel does not have to check if the gateway is reachable directly by the current machine (i.e., attached to the local network), so that we can insert the route in the kernel table without it being complained about. Defaults to "no".
|
||||||
|
GatewayOnLink = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
routeConfig = {
|
||||||
|
Gateway = cfg.ipv6_default_gateway;
|
||||||
|
GatewayOnLink = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
|
||||||
(attrsets.setAttrByPath [ cfg.network_interface ] (ip4config // ip6config));
|
|
||||||
|
|
||||||
networking.defaultGateway = {
|
|
||||||
address = cfg.lan_default_gateway;
|
|
||||||
interface = cfg.network_interface;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.defaultGateway6 = {
|
|
||||||
address = cfg.ipv6_default_gateway;
|
|
||||||
interface = cfg.network_interface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Configure Unbound DNS to redirect to Consul queries under .consul
|
# Configure Unbound DNS to redirect to Consul queries under .consul
|
||||||
|
|
Loading…
Reference in a new issue