From 0037f3fd6d31dd4a06c83b8350ea6083a6fec556 Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Tue, 13 Jun 2023 14:47:44 +0200 Subject: [PATCH] LoutreOS: replace dhcpd4 with networkd --- systems/LoutreOS/configuration.nix | 65 ++++++++++-------------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/systems/LoutreOS/configuration.nix b/systems/LoutreOS/configuration.nix index 49da3b0..86a6a54 100644 --- a/systems/LoutreOS/configuration.nix +++ b/systems/LoutreOS/configuration.nix @@ -57,10 +57,6 @@ id = 100; interface = "eno1"; }; - chinoiseries = { - id = 20; - interface = "eno2"; - }; }; interfaces = { @@ -74,11 +70,6 @@ { address = "10.30.0.1"; prefixLength = 16; } ]; }; - chinoiseries = { - ipv4.addresses = [ - { address = "10.40.0.1"; prefixLength = 16; } - ]; - }; enp0s21u2.useDHCP = true; }; @@ -88,8 +79,8 @@ externalInterface = "bouygues"; # Permet d'utiliser le SNAT plus rapide au lieu de MASQUERADE # externalIP = "0.0.0.0"; - internalIPs = [ "10.30.0.0/16" "10.40.0.0/16" ]; - internalInterfaces = [ "eno2" "chinoiseries" ]; + internalIPs = [ "10.30.0.0/16" ]; + internalInterfaces = [ "eno2" ]; forwardPorts = [ { destination = "10.30.0.1:22"; proto = "tcp"; sourcePort = 8443;} { destination = "10.30.135.35:25565"; proto = "tcp"; sourcePort = 25565; loopbackIPs=[ "195.36.180.44" ];} @@ -115,6 +106,26 @@ }; systemd.network.networks = { + "40-eno2" = { + networkConfig = { + DHCPServer = true; + }; + dhcpServerConfig = { + PoolOffset = 25599; + PoolSize = 25600; + DNS = [ "89.234.141.66" "80.67.169.12" "80.67.169.40" ]; + }; + dhcpServerStaticLeases = [ + { dhcpServerStaticLeaseConfig = { MACAddress = "50:c7:bf:b6:b8:ef"; Address = "10.30.50.7"; }; } # HS110 + { dhcpServerStaticLeaseConfig = { MACAddress = "ac:1f:6b:4b:01:15"; Address = "10.30.1.1"; }; } # IPMI + { dhcpServerStaticLeaseConfig = { MACAddress = "b4:2e:99:ed:24:26"; Address = "10.30.50.1"; }; } # paul-fixe + + #ESPHome + { dhcpServerStaticLeaseConfig = { MACAddress = "e0:98:06:85:e9:ce"; Address = "10.30.40.1"; }; } # salonled + { dhcpServerStaticLeaseConfig = { MACAddress = "e0:98:06:86:38:fc"; Address = "10.30.40.2"; }; } # bureauled + { dhcpServerStaticLeaseConfig = { MACAddress = "50:02:91:78:be:be"; Address = "10.30.40.3"; }; } # guirlande + ]; + }; "40-bouygues" = { dhcpV4Config.RouteMetric = 1; dhcpV6Config = { @@ -130,38 +141,6 @@ "40-enp0s21u2".dhcpV4Config.RouteMetric = 1024; }; - services.dhcpd4 = { - enable = true; - interfaces = [ "eno2" "chinoiseries" ]; - machines = [ - { ethernetAddress = "50:c7:bf:b6:b8:ef"; hostName = "HS110"; ipAddress = "10.30.50.7"; } - { ethernetAddress = "ac:1f:6b:4b:01:15"; hostName = "IPMI"; ipAddress = "10.30.1.1"; } - { ethernetAddress = "b4:2e:99:ed:24:26"; hostName = "paul-fixe"; ipAddress = "10.30.50.1"; } - - #ESPHome - { ethernetAddress = "e0:98:06:85:e9:ce"; hostName = "salonled"; ipAddress = "10.30.40.1"; } - { ethernetAddress = "e0:98:06:86:38:fc"; hostName = "bureauled"; ipAddress = "10.30.40.2"; } - { ethernetAddress = "50:02:91:78:be:be"; hostName = "guirlande"; ipAddress = "10.30.40.3"; } - - # YeeLights - { ethernetAddress = "04:cf:8c:b5:7e:18"; hostName = "yeelink-light-color3_miap7e18"; ipAddress = "10.40.249.0"; } - { ethernetAddress = "04:cf:8c:b5:2d:28"; hostName = "yeelink-light-color3_miap2d28"; ipAddress = "10.40.249.1"; } - { ethernetAddress = "04:cf:8c:b5:71:04"; hostName = "yeelink-light-color3_miap7104"; ipAddress = "10.40.249.2"; } - ]; - extraConfig = '' - option domain-name-servers 89.234.141.66, 80.67.169.12, 80.67.169.40; - option subnet-mask 255.255.0.0; - subnet 10.30.0.0 netmask 255.255.0.0 { - option routers 10.30.0.1; - range 10.30.100.0 10.30.200.0; - } - subnet 10.40.0.0 netmask 255.255.0.0 { - option routers 10.40.0.1; - range 10.40.100.0 10.40.200.0; - } - ''; - }; - nixpkgs.overlays = [ (import ../../overlays/transmission.nix) ];