From 6d6f1ee2e898f0b67bedf7c3e55c07fafaa34f9b Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Tue, 24 Oct 2023 21:47:13 +0200 Subject: improve network config --- common.nix | 16 ---------------- mini/configuration.nix | 21 +++++++++++++++------ neko/configuration.nix | 21 +++++++++++++++------ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/common.nix b/common.nix index 9ea74f1..d0440cc 100644 --- a/common.nix +++ b/common.nix @@ -67,22 +67,6 @@ in # allow all firmware hardware.enableAllFirmware = true; - # use systemd-networkd - networking.useDHCP = false; - systemd.network = { - enable = true; - networks."10-wan" = { - networkConfig = { - # start a DHCP Client for IPv4 Addressing/Routing - DHCP = "ipv4"; - # accept Router Advertisements for Stateless IPv6 Autoconfiguraton (SLAAC) - IPv6AcceptRA = true; - }; - # make routing on this interface a dependency for network-online.target - linkConfig.RequiredForOnline = "routable"; - }; - }; - # ensure firewall is up, allow ssh and http in networking.firewall.enable = true; networking.firewall.allowedTCPPorts = [ 22 ]; diff --git a/mini/configuration.nix b/mini/configuration.nix index a3899a8..5210fdd 100644 --- a/mini/configuration.nix +++ b/mini/configuration.nix @@ -14,12 +14,21 @@ /data/nixos/common.nix ]; - # host name - networking.hostName = "mini"; - - # main network interface - systemd.network.networks."10-wan".matchConfig.Name = "eno1"; - # amd graphics hardware.opengl.extraPackages = with pkgs; [ amdvlk rocm-opencl-icd rocm-opencl-runtime ]; + + # use systemd-networkd, fixed IPv4, dynamic IPv6 + networking.hostName = "mini"; + networking.useDHCP = false; + networking.nameservers = [ "192.168.13.1" ]; + systemd.network = { + enable = true; + networks."10-wan" = { + matchConfig.Name = "eno1"; + address = [ "192.168.13.100/24" ]; + routes = [ { routeConfig.Gateway = "192.168.13.1"; } ]; + networkConfig.IPv6AcceptRA = true; + linkConfig.RequiredForOnline = "routable"; + }; + }; } diff --git a/neko/configuration.nix b/neko/configuration.nix index 42c16e0..3af0537 100644 --- a/neko/configuration.nix +++ b/neko/configuration.nix @@ -14,12 +14,21 @@ /data/nixos/common.nix ]; - # host name - networking.hostName = "neko"; - - # main network interface - systemd.network.networks."10-wan".matchConfig.Name = "enp10s0"; - # intel graphics hardware.opengl.extraPackages = with pkgs; [ intel-media-driver intel-compute-runtime ]; + + # use systemd-networkd, fixed IPv4, dynamic IPv6 + networking.hostName = "neko"; + networking.useDHCP = false; + networking.nameservers = [ "192.168.13.1" ]; + systemd.network = { + enable = true; + networks."10-wan" = { + matchConfig.Name = "enp10s0"; + address = [ "192.168.13.171/24" ]; + routes = [ { routeConfig.Gateway = "192.168.13.1"; } ]; + networkConfig.IPv6AcceptRA = true; + linkConfig.RequiredForOnline = "routable"; + }; + }; } -- cgit v1.2.3