From 8c31e2d643806e723ac48a770a61c1f9fa23261f Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 13 Nov 2021 02:47:57 +0100 Subject: [PATCH] config/c3d2: cleanup --- config/c3d2.nix | 122 ++++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 77 deletions(-) diff --git a/config/c3d2.nix b/config/c3d2.nix index 66212c1..6d7cf4c 100644 --- a/config/c3d2.nix +++ b/config/c3d2.nix @@ -1,6 +1,9 @@ +{ lib, ... }: { site.net.c3d2 = { dhcp = { + server = "c3d2-gw3"; + start = "172.22.99.100"; end = "172.22.99.199"; fixed-hosts = { "172.22.99.96" = "08:00:27:bb:8c:b3"; @@ -49,14 +52,13 @@ "wormhole.hq.c3d2.de" = "00:23:c3:d2:00:76"; "www1.hq.c3d2.de" = "aa:00:13:8b:03:47"; }; + time = 86400; max-time = 2592000; router = "c3d2-anon"; - server = "c3d2-gw3"; - start = "172.22.99.100"; - time = 86400; }; domainName = "c3d2.zentralwerk.org"; dynamicDomain = true; + subnet4 = "172.22.99.0/24"; hosts4 = { bgp = "172.22.99.250"; c3d2-anon = "172.22.99.1"; @@ -65,98 +67,64 @@ c3d2-gw3 = "172.22.99.4"; dn42 = "172.22.99.253"; }; - hosts6 = { - dn42 = { - bgp = "fd23:42:c3d2:523::c3d2:ff0b"; - c3d2-anon = "fd23:42:c3d2:523::c3d2:1"; - c3d2-gw1 = "fd23:42:c3d2:523::c3d2:2"; - c3d2-gw2 = "fd23:42:c3d2:523::c3d2:3"; - c3d2-gw3 = "fd23:42:c3d2:523::c3d2:4"; - }; - up4 = { - bgp = "2a00:8180:2c00:223::c3d2:ff0b"; - c3d2-anon = "2a00:8180:2c00:223::c3d2:1"; - c3d2-gw1 = "2a00:8180:2c00:223::c3d2:2"; - c3d2-gw2 = "2a00:8180:2c00:223::c3d2:3"; - c3d2-gw3 = "2a00:8180:2c00:223::c3d2:4"; - }; + hosts6.dn42 = { + bgp = "fd23:42:c3d2:523::c3d2:ff0b"; + c3d2-anon = "fd23:42:c3d2:523::c3d2:1"; + c3d2-gw1 = "fd23:42:c3d2:523::c3d2:2"; + c3d2-gw2 = "fd23:42:c3d2:523::c3d2:3"; + c3d2-gw3 = "fd23:42:c3d2:523::c3d2:4"; + }; + hosts6.up4 = { + bgp = "2a00:8180:2c00:223::c3d2:ff0b"; + c3d2-anon = "2a00:8180:2c00:223::c3d2:1"; + c3d2-gw1 = "2a00:8180:2c00:223::c3d2:2"; + c3d2-gw2 = "2a00:8180:2c00:223::c3d2:3"; + c3d2-gw3 = "2a00:8180:2c00:223::c3d2:4"; }; - subnet4 = "172.22.99.0/24"; - subnet4Len = 24; - subnet4Net = "172.22.99.0"; subnets6 = { dn42 = "fd23:42:c3d2:523::/64"; up4 = "2a00:8180:2c00:223::/64"; }; }; - site.hosts = { - c3d2-anon = { + site.hosts = + let + makeGateway = lib.recursiveUpdate { + interfaces = { + c3d2.type = "veth"; + core.type = "veth"; + }; + role = "container"; + }; + in + { + c3d2-anon = makeGateway { interfaces = { - c3d2 = { - hwaddr = "0A:14:48:01:07:05"; - type = "veth"; - }; - core = { - hwaddr = "0A:14:48:01:07:04"; - type = "veth"; - }; + c3d2.hwaddr = "0A:14:48:01:07:05"; + core.hwaddr = "0A:14:48:01:07:04"; }; - ospf = { - allowedUpstreams = [ "anon1" "freifunk" ]; - }; - role = "container"; + ospf.allowedUpstreams = [ "anon1" "freifunk" ]; }; - c3d2-gw1 = { + c3d2-gw1 = makeGateway { interfaces = { - c3d2 = { - hwaddr = "0A:14:48:01:21:01"; - type = "veth"; - }; - core = { - hwaddr = "0A:14:48:01:21:00"; - type = "veth"; - }; + c3d2.hwaddr = "0A:14:48:01:21:01"; + core.hwaddr = "0A:14:48:01:21:00"; }; - ospf = { - allowedUpstreams = - [ "upstream3" "upstream4" "upstream1" "anon1" "freifunk" ]; - }; - role = "container"; + ospf.allowedUpstreams = [ "upstream3" "upstream4" "upstream1" "anon1" "freifunk" ]; }; - c3d2-gw2 = { + c3d2-gw2 = makeGateway { interfaces = { - c3d2 = { - hwaddr = "0A:14:48:01:21:03"; - type = "veth"; - }; - core = { - hwaddr = "0A:14:48:01:21:02"; - type = "veth"; - }; + c3d2.hwaddr = "0A:14:48:01:21:03"; + core.hwaddr = "0A:14:48:01:21:02"; }; - ospf = { - allowedUpstreams = - [ "upstream1" "upstream3" "upstream4" "anon1" "freifunk" ]; - }; - role = "container"; + ospf.allowedUpstreams = [ "upstream1" "upstream3" "upstream4" "anon1" "freifunk" ]; }; - c3d2-gw3 = { + c3d2-gw3 = makeGateway { interfaces = { - c3d2 = { - hwaddr = "0A:14:48:01:21:05"; - type = "veth"; - }; - core = { - hwaddr = "0A:14:48:01:21:04"; - type = "veth"; - }; + c3d2.hwaddr = "0A:14:48:01:21:05"; + core.hwaddr = "0A:14:48:01:21:04"; }; - ospf = { - allowedUpstreams = - [ "upstream4" "upstream3" "upstream1" "anon1" "freifunk" ]; - }; - role = "container"; + ospf.allowedUpstreams = [ "upstream4" "upstream3" "upstream1" "anon1" "freifunk" ]; }; }; }