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

View file

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