From 3e640d807e316f53eda8b674d6fe99bf179c2a87 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sat, 15 Feb 2025 04:03:15 -0500 Subject: [PATCH] Infini-FRAMEWORK/router: init --- hosts/Infini-FRAMEWORK/default.nix | 59 +----------------------------- hosts/Infini-FRAMEWORK/router.nix | 59 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 58 deletions(-) create mode 100644 hosts/Infini-FRAMEWORK/router.nix diff --git a/hosts/Infini-FRAMEWORK/default.nix b/hosts/Infini-FRAMEWORK/default.nix index e1782a1..8d80e79 100644 --- a/hosts/Infini-FRAMEWORK/default.nix +++ b/hosts/Infini-FRAMEWORK/default.nix @@ -9,6 +9,7 @@ ./hardware-configuration.nix ./filesystems.nix ./displays.nix + ./router.nix ]; system.stateVersion = "23.05"; @@ -163,62 +164,4 @@ } ]; }; - - specialisation.router.configuration = { - networking = { - interfaces."enp0s13f0u1" = { - ipv4.addresses = [ - { - address = "192.168.100.1"; - prefixLength = 24; - } - ]; - }; - - firewall.interfaces."enp0s13f0u1" = { - allowedTCPPorts = [ 53 ]; - allowedUDPPorts = [ - 53 - 67 - ]; - }; - - nat = { - enable = true; - internalInterfaces = [ "enp0s13f0u1" ]; - externalInterface = "wlp170s0"; - }; - }; - - services.dnsmasq = { - enable = true; - settings = { - server = [ - "8.8.8.8" - "1.1.1.1" - ]; - domain-needed = true; - bogus-priv = true; - no-resolv = true; - - cache-size = 1000; - - dhcp-range = [ "enp0s13f0u1,192.168.100.10,192.168.100.100" ]; - interface = "enp0s13f0u1"; - dhcp-host = "192.168.100.1"; - - local = "/lan/"; - domain = "lan"; - expand-hosts = true; - - no-hosts = true; - address = "/infini-framework.lan/192.168.100.1"; - }; - }; - - boot.kernel.sysctl = { - "net.ipv4.conf.all.forwarding" = true; - "net.ipv6.conf.all.forwarding" = true; - }; - }; } diff --git a/hosts/Infini-FRAMEWORK/router.nix b/hosts/Infini-FRAMEWORK/router.nix new file mode 100644 index 0000000..234c97a --- /dev/null +++ b/hosts/Infini-FRAMEWORK/router.nix @@ -0,0 +1,59 @@ +{ + specialisation.router.configuration = { + networking = { + interfaces."enp0s13f0u1" = { + ipv4.addresses = [ + { + address = "192.168.100.1"; + prefixLength = 24; + } + ]; + }; + + firewall.interfaces."enp0s13f0u1" = { + allowedTCPPorts = [ 53 ]; + allowedUDPPorts = [ + 53 + 67 + ]; + }; + + nat = { + enable = true; + internalInterfaces = [ "enp0s13f0u1" ]; + externalInterface = "wlp170s0"; + }; + }; + + services.dnsmasq = { + enable = true; + settings = { + server = [ + "8.8.8.8" + "1.1.1.1" + ]; + domain-needed = true; + bogus-priv = true; + no-resolv = true; + + cache-size = 1000; + + dhcp-range = [ "enp0s13f0u1,192.168.100.10,192.168.100.100" ]; + interface = "enp0s13f0u1"; + dhcp-host = "192.168.100.1"; + + local = "/lan/"; + domain = "lan"; + expand-hosts = true; + + no-hosts = true; + address = "/infini-framework.lan/192.168.100.1"; + }; + }; + + boot.kernel.sysctl = { + "net.ipv4.conf.all.forwarding" = true; + "net.ipv6.conf.all.forwarding" = true; + }; + }; +}