From 790201fcf19b776588c47b916a77ea0aeaa42683 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sat, 23 Nov 2024 04:26:04 -0500 Subject: [PATCH] Infini-FRAMEWORK: setup NAT and DHCP networking --- hosts/Infini-FRAMEWORK/default.nix | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/hosts/Infini-FRAMEWORK/default.nix b/hosts/Infini-FRAMEWORK/default.nix index 9bc5a42..294882f 100644 --- a/hosts/Infini-FRAMEWORK/default.nix +++ b/hosts/Infini-FRAMEWORK/default.nix @@ -11,6 +11,7 @@ persist = { directories = [ + { directory = "/var/lib/dnsmasq/"; user = "dnsmasq"; } ]; files = [ @@ -99,4 +100,54 @@ sshUser = "remotebuild"; } ]; + + networking = { + interfaces = { + "wlp170s0".useDHCP = true; + "enp0s13f0u1" = { + ipv4.addresses = [{ + address = "192.168.100.1"; + prefixLength = 24; + }]; + }; + }; + firewall.interfaces = { + "enp0s13f0u1".allowedTCPPorts = [ 53 ]; + "enp0s13f0u1".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; + }; }