From 011d2ff791326df1d8383f6895ccc8d65b1ec318 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Dec 2021 10:19:50 +0100 Subject: yggdrasil-wg: ... --- modules/yggdrasil-wg/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/yggdrasil-wg') diff --git a/modules/yggdrasil-wg/default.nix b/modules/yggdrasil-wg/default.nix index 67d73b70..1ffb8af6 100644 --- a/modules/yggdrasil-wg/default.nix +++ b/modules/yggdrasil-wg/default.nix @@ -203,7 +203,8 @@ in { Destination = "${batSubnet}::/${toString batSubnetLength}"; }; } - ] ++ (concatMap (router: map (rAddr: { routeConfig = { Destination = "::/0"; Metric = 2048; Gateway = stripSubnet rAddr; }; }) batHostIPs.${router}) routers); + ] ++ (concatMap (router: map (rAddr: { routeConfig = { Destination = "::/0"; Gateway = stripSubnet rAddr; Table = "yggdrasil"; }; }) batHostIPs.${router}) routers); + routingPolicyRules = map (addr: { routingPolicyRuleConfig = { Table = "yggdrasil"; From = stripSubnet addr; Priority = 1; }; }) batHostIPs.${hostName}; linkConfig = { MACAddress = "${batHostMACs.${hostName}}"; RequiredForOnline = false; @@ -212,6 +213,13 @@ in { } // listToAttrs (map familyToYggdrasilNetwork hostFamilies) // listToAttrs (concatMap (family: imap0 (linkToGreNetwork family) hostLinks.${family}) hostFamilies); }; + environment.etc."systemd/networkd.conf" = mkIf inNetwork { + text = '' + [Network] + RouteTable=yggdrasil:200 + ''; + }; + sops.secrets = listToAttrs (map familyToSopsSecret hostFamilies); networking.hosts = mkIf inNetwork (listToAttrs (concatMap ({name, value}: map (ip: nameValuePair (stripSubnet ip) ["${name}.yggdrasil"]) value) (mapAttrsToList nameValuePair batHostIPs))); -- cgit v1.2.3