From 986d84fb451a488352e29a401ec75e642b55d185 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Thu, 28 Nov 2024 16:44:27 +0100 Subject: [PATCH] machines/resolver[1-2].ff.tomhe.de: init mesh --- machines/resolver1.ff.tomhe.de/default.nix | 1 + machines/resolver1.ff.tomhe.de/resolver.nix | 33 ++++++++++++ machines/resolver2.ff.tomhe.de/default.nix | 1 + machines/resolver2.ff.tomhe.de/resolver.nix | 33 ++++++++++++ roles/resolver/default.nix | 56 +++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 machines/resolver1.ff.tomhe.de/resolver.nix create mode 100644 machines/resolver2.ff.tomhe.de/resolver.nix create mode 100644 roles/resolver/default.nix diff --git a/machines/resolver1.ff.tomhe.de/default.nix b/machines/resolver1.ff.tomhe.de/default.nix index c67ae7c..d0930a2 100644 --- a/machines/resolver1.ff.tomhe.de/default.nix +++ b/machines/resolver1.ff.tomhe.de/default.nix @@ -9,6 +9,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ../../roles/all.nix + ./resolver.nix ]; boot.kernelParams = [ "console=ttyS0,115200n8" ]; diff --git a/machines/resolver1.ff.tomhe.de/resolver.nix b/machines/resolver1.ff.tomhe.de/resolver.nix new file mode 100644 index 0000000..ff9ca06 --- /dev/null +++ b/machines/resolver1.ff.tomhe.de/resolver.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../../modules/freifunk + ../../roles/resolver + ]; + + modules.freifunk.gateway = { + vxlan.local = "2a01:4f8:171:3242:5054:ff:fefa:a211"; + domains = { + dom0 = { + batmanAdvanced.mac = "47:8a:5a:96:18:4e"; + ipv4 = { + prefixes."10.1.64.0/20" = {}; + }; + ipv6 = { + prefixes = { + "fdeb:52c8:d094:1000::/64" = { + addresses =[ + "fdeb:52c8:d094:1000::53:1" + ]; + }; + "2a01:4f8:160:97c0::/64" = { + addresses =[ + "2a01:4f8:160:97c0::53:1" + ]; + }; + }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/machines/resolver2.ff.tomhe.de/default.nix b/machines/resolver2.ff.tomhe.de/default.nix index 0c8e247..12e5ebf 100644 --- a/machines/resolver2.ff.tomhe.de/default.nix +++ b/machines/resolver2.ff.tomhe.de/default.nix @@ -9,6 +9,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ../../roles/all.nix + ./resolver.nix ]; boot.kernelParams = [ "console=ttyS0,115200n8" ]; diff --git a/machines/resolver2.ff.tomhe.de/resolver.nix b/machines/resolver2.ff.tomhe.de/resolver.nix new file mode 100644 index 0000000..ba46890 --- /dev/null +++ b/machines/resolver2.ff.tomhe.de/resolver.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../../modules/freifunk + ../../roles/resolver + ]; + + modules.freifunk.gateway = { + vxlan.local = "2a01:4f8:140:4093:5054:ff:fe2c:c94b"; + domains = { + dom0 = { + batmanAdvanced.mac = "b6:38:a8:1d:8c:b3"; + ipv4 = { + prefixes."10.1.64.0/20" = {}; + }; + ipv6 = { + prefixes = { + "fdeb:52c8:d094:1000::/64" = { + addresses =[ + "fdeb:52c8:d094:1000::53:2" + ]; + }; + "2a01:4f8:160:97c0::/64" = { + addresses =[ + "2a01:4f8:160:97c0::53:2" + ]; + }; + }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/roles/resolver/default.nix b/roles/resolver/default.nix new file mode 100644 index 0000000..8024a79 --- /dev/null +++ b/roles/resolver/default.nix @@ -0,0 +1,56 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../../modules/freifunk + ]; + + modules.freifunk.gateway = { + enable = true; + yanic.enable = false; + dnsSearchDomain = [ + "ff.tomhe.de" + ]; + domains = { + dom0 = { + fastd.enable = false; + names = { + dom0 = "Domain 0"; + ffda_default = "Default"; + }; + bird.enable = false; + vxlan.vni = 97726; + ipv4 = { + # subnet = "10.1.64.0/20"; + prefixes."10.1.64.0/20" = {}; + + # address = "10.1.64.1"; + dhcpV4 = { + enable = lib.mkDefault false; + dnsServers = [ "10.1.67.254" ]; + # pools = [ + # "10.1.64.8 - 10.1.64.255" + # "10.1.65.8 - 10.84.3.255" + # ]; + }; + }; + ipv6 = { + dnsServers = [ + "fdeb:52c8:d094:1000::1:1" + ]; + }; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + bridge-utils + git + fastd + jq + batctl + tcpdump + ]; + + systemd.network.networks."10-mainif".networkConfig.VXLAN = config.modules.freifunk.gateway.vxlan.interfaceNames; + +} \ No newline at end of file