infrastructure/machines/vault01/user_vlans.nix

14 lines
571 B
Nix

let
mkUserVlan = id: rec {
# on alloue 10.0.0.0/17 aux thurnés, avec un /27 chacun, on garde 10.0.0.0/27 pour nous (routeur et autres)
vlan = 4094 - id;
prefix24nb = (id + 1) / 8;
prefix27nb = (id + 1 - prefix24nb * 8) * 32;
prefixLength = 27;
netIP = "10.0.${toString prefix24nb}.${toString prefix27nb}";
servIP = "10.0.${toString prefix24nb}.${toString (prefix27nb + 1)}";
broadIP = "10.0.${toString prefix24nb}.${toString (prefix27nb + 31)}";
interfaceName = "vlan-user-${toString vlan}";
};
in
builtins.genList mkUserVlan 850