From 56db344be887b79bca3516f523c86ecb4cf01ae2 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 17 Jul 2022 15:34:17 +0200 Subject: [PATCH] router, pre-router: move DHCP server --- hosts/pre-router/configuration.nix | 1 - hosts/pre-router/dhcp.nix | 42 ------------------------------ hosts/router/10-net-services.nix | 25 ++++++++++++++++++ 3 files changed, 25 insertions(+), 43 deletions(-) delete mode 100644 hosts/pre-router/dhcp.nix diff --git a/hosts/pre-router/configuration.nix b/hosts/pre-router/configuration.nix index 8fa5077..a16a7ef 100644 --- a/hosts/pre-router/configuration.nix +++ b/hosts/pre-router/configuration.nix @@ -5,7 +5,6 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./router.nix - ./dhcp.nix ./dns.nix ./ipv6.nix ./nginx.nix diff --git a/hosts/pre-router/dhcp.nix b/hosts/pre-router/dhcp.nix deleted file mode 100644 index ae886ab..0000000 --- a/hosts/pre-router/dhcp.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, pkgs, ...}: - -{ - services.kea.dhcp4 = { - enable = true; - settings = { - interfaces-config = { - interfaces = [ "ens19"]; - }; - lease-database = { - name = "/var/lib/kea/dhcp4.leases"; - persist = true; - type = "memfile"; - }; - subnet4 = [ - # Heimnetz - { - subnet = "10.42.10.1/24"; - pools = [ - { - pool = "10.42.10.50 - 10.42.10.240"; - } - ]; - option-data = [ - { - name = "routers"; - data = "10.42.10.1"; - } - { - name = "domain-name-servers"; - data = "10.42.10.8"; - } - { - name = "domain-name"; - data = "bula22.de"; - } - ]; - } - ]; - }; - }; -} diff --git a/hosts/router/10-net-services.nix b/hosts/router/10-net-services.nix index 185c961..d563f4f 100644 --- a/hosts/router/10-net-services.nix +++ b/hosts/router/10-net-services.nix @@ -27,6 +27,31 @@ }; ''; + services.kea.dhcp4 = { + settings = { + interfaces-config = { + interfaces = [ "net-services" ]; + }; + subnet4 = [ + { + id = 10; + subnet = "10.42.10.1/24"; + pools = [ + { + pool = "10.42.10.100 - 10.42.10.240"; + } + ]; + option-data = [ + { + name = "routers"; + data = "10.42.10.1"; + } + ]; + } + ]; + }; + }; + # Everyone is allowed reaching this, no firewall therefore clerie.uplink-selector.interfaces.net-services.uplink = "uplink-a";