infrastructure/machines/vault01/networking.nix

103 lines
2.1 KiB
Nix
Raw Normal View History

2024-03-27 10:26:31 +01:00
let
vlanName = "vlan-uplink-cri";
2024-04-05 14:33:56 +02:00
vlanAdmin = "vlan-admin";
2024-04-06 19:21:03 +02:00
vlanAP = "vlan-admin-ap";
vlanAP-apro = "vlan-apro";
linkIp = "10.120.33.250";
linkPrefix = "30";
upstreamRouterIp = "10.120.33.249";
publicIp = "129.199.195.129"; # sync with meta
linkPrefixedIp = "${linkIp}/${linkPrefix}";
2024-03-27 10:26:31 +01:00
in
{
systemd.network = {
networks = {
"10-enp67s0f0np0" = {
2024-03-27 10:26:31 +01:00
name = "enp67s0f0np0";
networkConfig = {
2024-04-05 14:33:56 +02:00
VLAN = [
vlanName
vlanAdmin
2024-04-06 19:21:03 +02:00
vlanAP
vlanAP-apro
2024-04-05 14:33:56 +02:00
];
2024-03-27 10:26:31 +01:00
LinkLocalAddressing = false;
LLDP = false;
EmitLLDP = false;
IPv6AcceptRA = false;
IPv6SendRA = false;
};
};
"10-${vlanName}" = {
2024-03-27 10:26:31 +01:00
name = vlanName;
address = [ linkPrefixedIp ];
routes = [
{
routeConfig = {
PreferredSource = publicIp;
Gateway = upstreamRouterIp;
};
}
];
2024-03-27 10:26:31 +01:00
};
2024-04-05 14:33:56 +02:00
"10-${vlanAdmin}" = {
name = vlanAdmin;
2024-04-06 19:18:56 +02:00
address = [ "fd26:baf9:d250:8000::1/64" ];
2024-04-05 14:33:56 +02:00
};
2024-04-06 19:21:03 +02:00
"10-${vlanAP}" = {
name = vlanAP;
address = [ "fd26:baf9:d250:8010::1/60" ];
};
"10-${vlanAP-apro}" = {
name = vlanAP-apro;
address = [ "10.0.255.1/24" ];
networkConfig.DHCPServer = "yes";
};
2024-03-27 10:26:31 +01:00
};
netdevs = {
2024-04-05 14:33:56 +02:00
"10-${vlanName}" = {
2024-03-27 10:26:31 +01:00
netdevConfig = {
Name = vlanName;
Kind = "vlan";
};
vlanConfig = {
Id = 223;
};
};
2024-04-05 14:33:56 +02:00
"10-${vlanAdmin}" = {
netdevConfig = {
Name = vlanAdmin;
Kind = "vlan";
};
vlanConfig = {
Id = 3000;
};
};
2024-04-06 19:21:03 +02:00
"10-${vlanAP}" = {
netdevConfig = {
Name = vlanAP;
Kind = "vlan";
};
vlanConfig = {
Id = 3001;
};
};
"10-${vlanAP-apro}" = {
netdevConfig = {
Name = vlanAP-apro;
Kind = "vlan";
};
vlanConfig = {
Id = 2000;
};
};
2024-03-27 10:26:31 +01:00
};
};
networking.firewall.allowedUDPPorts = [ 67 ];
2024-03-27 10:26:31 +01:00
}