2023-06-05 15:50:07 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, ...
|
|
|
|
}: {
|
|
|
|
# use networkd
|
|
|
|
networking.dhcpcd.enable = false;
|
|
|
|
systemd.network.enable = true;
|
|
|
|
|
|
|
|
# add an entry to /etc/hosts for each host
|
|
|
|
networking.extraHosts = lib.concatStringsSep "\n" (lib.mapAttrsToList
|
|
|
|
(name: host: ''
|
|
|
|
${lib.optionalString (host.ipv4 != null) "${host.ipv4} ${name}"}
|
|
|
|
${lib.optionalString (host.ipv6 != null) "${host.ipv6} ${name}"}
|
|
|
|
'')
|
|
|
|
config.networking.newtype.hosts);
|
|
|
|
|
2024-06-23 18:24:46 +00:00
|
|
|
# leave container interfaces alone unless otherwise specified
|
|
|
|
systemd.network.networks."95-veth".extraConfig = ''
|
2023-06-05 15:50:07 +00:00
|
|
|
[Match]
|
|
|
|
Driver = veth
|
|
|
|
|
|
|
|
[Link]
|
|
|
|
Unmanaged = yes
|
|
|
|
'';
|
|
|
|
|
|
|
|
systemd.network.networks."10-nat-lan" = {
|
|
|
|
matchConfig.Name = "nat-lan";
|
|
|
|
linkConfig.RequiredForOnline = true;
|
|
|
|
DHCP = "yes";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.network.links."10-nat-lan" = {
|
|
|
|
matchConfig.MACAddress = "3c:ec:ef:7e:bd:c8";
|
|
|
|
linkConfig.Name = "nat-lan";
|
|
|
|
};
|
|
|
|
|
2024-06-23 01:14:26 +00:00
|
|
|
systemd.network.netdevs."10-wan-br" = {
|
|
|
|
netdevConfig.Name = "wan-br";
|
|
|
|
netdevConfig.Kind = "bridge";
|
|
|
|
netdevConfig.MACAddress = "none";
|
|
|
|
bridgeConfig.MulticastSnooping = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.network.links."10-wan-br" = {
|
|
|
|
matchConfig.Name = "wan-br";
|
|
|
|
linkConfig.MACAddressPolicy = "none";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.network.networks."10-wan-br" = {
|
|
|
|
matchConfig.Name = "wan-br";
|
2023-06-05 15:50:07 +00:00
|
|
|
linkConfig.RequiredForOnline = true;
|
|
|
|
networkConfig.Address = [ config.networking.newtype.currentHost.ipv6 ];
|
|
|
|
};
|
|
|
|
|
2024-06-23 01:14:26 +00:00
|
|
|
systemd.network.networks."10-wan" = {
|
|
|
|
matchConfig.Name = "wan";
|
|
|
|
networkConfig.Bridge = "wan-br";
|
|
|
|
};
|
|
|
|
|
2023-06-05 15:50:07 +00:00
|
|
|
systemd.network.links."10-wan" = {
|
|
|
|
matchConfig.MACAddress = "3c:ec:ef:7e:bd:c9";
|
|
|
|
linkConfig.Name = "wan";
|
|
|
|
};
|
|
|
|
|
|
|
|
deployment.targetHost = "${config.networking.hostName}.infra.newtype.fr";
|
|
|
|
}
|