From c6563b3cf4e9c93f3c68c7f2395c33c377e5dc9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Wed, 8 Nov 2023 01:16:00 +0100 Subject: [PATCH] fix: more fixes to networking, but dhcp6 not working yet --- hosts/biolimo/networking.nix | 3 ++ hosts/chocolatebar/networking.nix | 2 ++ hosts/droppie/hardware-configuration.nix | 8 ----- hosts/droppie/networking.nix | 8 +++++ hosts/pie/dhcpd.nix | 39 ++++++++++++++++-------- hosts/pie/hardware-configuration.nix | 8 ----- hosts/pie/networking.nix | 11 +++++-- 7 files changed, 48 insertions(+), 31 deletions(-) diff --git a/hosts/biolimo/networking.nix b/hosts/biolimo/networking.nix index 63ef011..18bb406 100644 --- a/hosts/biolimo/networking.nix +++ b/hosts/biolimo/networking.nix @@ -2,9 +2,12 @@ flake, config, pkgs, + lib, ... }: { config = { + networking.useDHCP = lib.mkDefault true; + age.secrets.wg-private-key.file = "${flake.self}/secrets/wg-private-biolimo.age"; pub-solar.wireguard-client = { diff --git a/hosts/chocolatebar/networking.nix b/hosts/chocolatebar/networking.nix index 85927bc..5bfea46 100644 --- a/hosts/chocolatebar/networking.nix +++ b/hosts/chocolatebar/networking.nix @@ -5,6 +5,8 @@ ... }: { config = { + networking.useDHCP = lib.mkDefault true; + age.secrets.wg-private-key.file = "${flake.self}/secrets/wg-private-chocolatebar.age"; pub-solar.wireguard-client = { diff --git a/hosts/droppie/hardware-configuration.nix b/hosts/droppie/hardware-configuration.nix index d51cfed..e8c00a8 100644 --- a/hosts/droppie/hardware-configuration.nix +++ b/hosts/droppie/hardware-configuration.nix @@ -34,14 +34,6 @@ swapDevices = [{device = "/dev/disk/by-uuid/0203b641-280f-4a3d-971d-fd32a666c852";}]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; - networking.interfaces.enp2s0f1.useDHCP = lib.mkDefault true; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/droppie/networking.nix b/hosts/droppie/networking.nix index 3c6f389..6ff938c 100644 --- a/hosts/droppie/networking.nix +++ b/hosts/droppie/networking.nix @@ -6,6 +6,14 @@ }: { networking.hostName = "droppie"; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault false; + networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault false; + networking.interfaces.enp2s0f1.useDHCP = lib.mkDefault false; + networking.interfaces.enp2s0f0 = { ipv4.addresses = [ { address = "192.168.178.3"; prefixLength = 32; } ]; ipv6.addresses = [ { address = "2a02:908:5b1:e3c0:3::"; prefixLength = 128; } ]; diff --git a/hosts/pie/dhcpd.nix b/hosts/pie/dhcpd.nix index 98a2e37..8da0b55 100644 --- a/hosts/pie/dhcpd.nix +++ b/hosts/pie/dhcpd.nix @@ -10,7 +10,6 @@ dhcp-socket-type = "raw"; interfaces = [ "enabcm6e4ei0" - "wlan0" ]; }; @@ -47,11 +46,7 @@ ]; reservations = [ - { - hostname = "pie.local"; - hw-address = "dc:a6:32:5c:31:64"; - ip-address = "192.168.178.2"; - } + # Pie should set ip itself { hostname = "droppie.local"; hw-address = "08:f1:ea:97:0f:0c"; @@ -62,6 +57,16 @@ hw-address = "b8:76:3f:64:a3:64"; ip-address = "192.168.178.4"; } + # { + # hostname = "chocolatebar.local"; + # hw-address = "48:a4:72:1d:29:32"; + # ip-address = "192.168.178.5"; + # } + { + hostname = "biolimo.local"; + hw-address = "48:a4:72:1d:29:32"; + ip-address = "192.168.178.6"; + } ]; } ]; @@ -74,15 +79,19 @@ interfaces-config = { interfaces = [ "enabcm6e4ei0" - "wlan0" ]; }; + lease-database = { name = "/var/lib/kea/dhcp6.leases"; persist = true; type = "memfile"; }; + rebind-timer = 2000; + renew-timer = 1000; + valid-lifetime = 4000; + subnet6 = [ { subnet = "2a02:908:5b1:e3c0::/64"; @@ -109,19 +118,23 @@ "2a02:908:5b1:e3c0:3::" ]; } + # { + # hostname = "chocolatebar.local"; + # hw-address = "08:f1:ea:97:0f:0c"; + # ip-addresses = [ + # "2a02:908:5b1:e3c0:5::" + # ]; + # } { - hostname = "pie.local"; - hw-address = "dc:a6:32:5c:31:64"; + hostname = "biolimo.local"; + hw-address = "48:a4:72:1d:29:32"; ip-addresses = [ - "2a02:908:5b1:e3c0:2::" + "2a02:908:5b1:e3c0:6::" ]; } ]; } ]; - - rebind-timer = 2000; - renew-timer = 1000; }; }; } diff --git a/hosts/pie/hardware-configuration.nix b/hosts/pie/hardware-configuration.nix index 1460bff..8c09beb 100644 --- a/hosts/pie/hardware-configuration.nix +++ b/hosts/pie/hardware-configuration.nix @@ -36,14 +36,6 @@ ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.end0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; } diff --git a/hosts/pie/networking.nix b/hosts/pie/networking.nix index 7638f7a..82131ca 100644 --- a/hosts/pie/networking.nix +++ b/hosts/pie/networking.nix @@ -5,6 +5,8 @@ lib, ... }: { + networking.useDHCP = lib.mkDefault false; + networking.hostId = "34234773"; networking.hostName = "pie"; networking.defaultGateway = { @@ -13,8 +15,13 @@ }; networking.interfaces.enabcm6e4ei0 = { - ipv4.addresses = [ { address = "192.168.178.2"; prefixLength = 32; } ]; - ipv6.addresses = [ { address = "2a02:908:5b1:e3c0:2::"; prefixLength = 128; } ]; + ipv4.addresses = [ + { address = "192.168.178.2"; prefixLength = 32; } + ]; + ipv6.addresses = [ + { address = "2a02:908:5b1:e3c0:2::"; prefixLength = 128; } + { address = "fe80::b12f:acab:1312:acab"; prefixLength = 128; } + ]; }; networking.firewall.allowedTCPPorts = [ 80 443 ];