chore(networking): Attributes have to me moved up

This commit is contained in:
Tom Hubrecht 2024-12-15 17:59:50 +01:00
parent a2d397de70
commit 046ed0c005
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 24 additions and 42 deletions

View file

@ -61,28 +61,22 @@ let
linkConfig.Promiscuous = true;
addresses = [
{
addressConfig = {
Address = "${servIP}/27";
AddPrefixRoute = false;
};
Address = "${servIP}/27";
AddPrefixRoute = false;
}
];
routes = [
{
routeConfig = {
Destination = "${netIP}/27";
Table = "user";
};
Destination = "${netIP}/27";
Table = "user";
}
];
routingPolicyRules = [
{
routingPolicyRuleConfig = {
From = "${netIP}/27";
To = "10.0.0.0/27";
IncomingInterface = interfaceName;
Table = "user";
};
From = "${netIP}/27";
To = "10.0.0.0/27";
IncomingInterface = interfaceName;
Table = "user";
}
];
};
@ -105,11 +99,9 @@ let
extraNetwork.routes = [
{
routeConfig = {
# Get the public ip from the metadata
PreferredSource = builtins.head meta.network.${name}.addresses.ipv4;
Gateway = uplink.router;
};
# Get the public ip from the metadata
PreferredSource = builtins.head meta.network.${name}.addresses.ipv4;
Gateway = uplink.router;
}
];
};
@ -124,11 +116,9 @@ let
address = [ "fd26:baf9:d250:8001::1/64" ];
extraNetwork.ipv6Prefixes = [
{
ipv6PrefixConfig = {
AddressAutoconfiguration = false;
OnLink = false;
Prefix = "fd26:baf9:d250:8001::/64";
};
AddressAutoconfiguration = false;
OnLink = false;
Prefix = "fd26:baf9:d250:8001::/64";
}
];
};
@ -156,18 +146,14 @@ in
];
routes = [
{
routeConfig = {
Destination = "10.0.0.0/27";
Table = "user";
};
Destination = "10.0.0.0/27";
Table = "user";
}
];
routingPolicyRules = [
{
routingPolicyRuleConfig = {
IncomingInterface = "lo";
Table = "user";
};
IncomingInterface = "lo";
Table = "user";
}
];
};
@ -248,12 +234,10 @@ in
wireguardPeers = [
{
wireguardPeerConfig = {
AllowedIPs = [
"10.10.17.0/30"
];
PublicKey = "g6S3gBx1Hf2iX41tokD+m8WfzJJTTcsKifOkn+Wcd00=";
};
AllowedIPs = [
"10.10.17.0/30"
];
PublicKey = "g6S3gBx1Hf2iX41tokD+m8WfzJJTTcsKifOkn+Wcd00=";
}
];
};

View file

@ -18,10 +18,8 @@ let
mkAddress = { address, prefixLength, ... }: "${address}/${builtins.toString prefixLength}";
mkRoute = gateway: {
routeConfig = {
Gateway = gateway;
GatewayOnLink = true;
};
Gateway = gateway;
GatewayOnLink = true;
};
mkInterface = interface: net: {