From 957d91180a348406e204010d012f83502a75dd70 Mon Sep 17 00:00:00 2001 From: Serge Bazanski Date: Sun, 12 Jun 2022 12:26:02 +0200 Subject: [PATCH] bgpwtf: edge01: bump nixpkgs, use networkd Change-Id: I038f9518e090aecc90f464475f29c5b3c1570eff Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1339 Reviewed-by: implr --- bgpwtf/machines/modules/bootstrap.nix | 2 ++ bgpwtf/machines/modules/gretap.nix | 16 ++++++++++----- bgpwtf/machines/modules/router.nix | 3 ++- .../{edge01-waw.nix => edge01-waw-bgp.nix} | 0 ops/machines.nix | 20 +------------------ 5 files changed, 16 insertions(+), 25 deletions(-) rename bgpwtf/machines/tests/{edge01-waw.nix => edge01-waw-bgp.nix} (100%) diff --git a/bgpwtf/machines/modules/bootstrap.nix b/bgpwtf/machines/modules/bootstrap.nix index 120bf8c4..56524d2d 100644 --- a/bgpwtf/machines/modules/bootstrap.nix +++ b/bgpwtf/machines/modules/bootstrap.nix @@ -6,6 +6,8 @@ networking.interfaces.bootstrap.ipv4.addresses = [ { address = "185.236.240.18"; prefixLength = 32; } ]; + systemd.network.networks."40-bootstrap".networkConfig.IgnoreCarrierLoss = true; + systemd.network.networks."40-bootstrap".networkConfig.ConfigureWithoutCarrier = true; services.atftpd = { enable = true; root = (let diff --git a/bgpwtf/machines/modules/gretap.nix b/bgpwtf/machines/modules/gretap.nix index f4e1a7b2..f28d64c1 100644 --- a/bgpwtf/machines/modules/gretap.nix +++ b/bgpwtf/machines/modules/gretap.nix @@ -41,22 +41,28 @@ in { config.boot.kernelModules = [ "fou" ]; config.systemd.services = mapAttrs' (name: value: nameValuePair "${name}-gretap" { - wants = [ + wants = if config.networking.useNetworkd then [ + "systemd-networkd.service" + ] else [ "${name}-netdev.service" "network-addresses-${value.parent}.service" ]; - after = [ + after = if config.networking.useNetworkd then [ + "systemd-networkd.service" + ] else [ "network-addresses-${value.parent}.service" ]; - before = [ + before = if config.networking.useNetworkd then [] else [ "network-addresses-${name}.service" ]; - wantedBy = [ + wantedBy = if config.networking.useNetworkd then [ + "network-online.target" + ] else [ "network-addresses-${name}.service" ]; serviceConfig = { Type = "oneshot"; - ExecStart = "${pkgs.iproute}/bin/ip link add name ${name} type gretap remote ${value.remoteV4} local ${value.localV4} key ${toString value.id}"; + ExecStart = "${pkgs.iproute2}/bin/ip link add name ${name} type gretap remote ${value.remoteV4} local ${value.localV4} key ${toString value.id}"; }; }) cfg.interfaces; } diff --git a/bgpwtf/machines/modules/router.nix b/bgpwtf/machines/modules/router.nix index 953b277c..f476077a 100644 --- a/bgpwtf/machines/modules/router.nix +++ b/bgpwtf/machines/modules/router.nix @@ -16,10 +16,11 @@ rec { environment.systemPackages = with pkgs; [ tcpdump htop dstat file strace gdb mtr vim wget curl htop dstat whois bind - rxvt_unicode.terminfo dhcpcd efibootmgr + rxvt-unicode-unwrapped.terminfo dhcpcd efibootmgr ]; networking.useDHCP = false; networking.firewall.enable = false; + networking.useNetworkd = true; boot.kernel.sysctl."net.ipv4.ip_forward" = 1; boot.kernel.sysctl."net.ipv4.conf.*.accept_redirects" = 0; boot.kernel.sysctl."net.ipv4.conf.*.send_redirects" = 0; diff --git a/bgpwtf/machines/tests/edge01-waw.nix b/bgpwtf/machines/tests/edge01-waw-bgp.nix similarity index 100% rename from bgpwtf/machines/tests/edge01-waw.nix rename to bgpwtf/machines/tests/edge01-waw-bgp.nix diff --git a/ops/machines.nix b/ops/machines.nix index 5d09d743..bc808a64 100644 --- a/ops/machines.nix +++ b/ops/machines.nix @@ -42,24 +42,6 @@ let ]; }; - # edge01 still lives on an old nixpkgs checkout. - # - # TODO(b/3): unpin and deploy. - nixpkgsBgpwtf = import (pkgs.fetchFromGitHub { - owner = "nixos"; - repo = "nixpkgs-channels"; - rev = "c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38"; - sha256 = "1ak7jqx94fjhc68xh1lh35kh3w3ndbadprrb762qgvcfb8351x8v"; - }) {}; - - # customs.hackerspace.pl migration temporary checkout - nixpkgsCustoms = import (pkgs.fetchFromGitHub { - owner = "nixos"; - repo = "nixpkgs"; - rev = "d12178b1c4a6ef1232c8c677573ba9db204e66ff"; - sha256 = "0p7df7yzi35kblxr5ks0rxxp9cfh269g88xpj60sdhdjvfnn6cp7"; - }) {}; - # mkMachine builds NixOS modules into a NixOS derivation. # It: # 1) injects passthru.hscloud.provision which deploys that configuration @@ -144,7 +126,7 @@ let "dcr01s22.hswaw.net" = mkClusterMachine self ../cluster/machines/dcr01s22.hswaw.net.nix; "dcr01s24.hswaw.net" = mkClusterMachine self ../cluster/machines/dcr01s24.hswaw.net.nix; - "edge01.waw.bgp.wtf" = mkMachine self nixpkgsBgpwtf [ + "edge01.waw.bgp.wtf" = mkMachine self pkgs [ ../bgpwtf/machines/edge01.waw.bgp.wtf.nix ../bgpwtf/machines/edge01.waw.bgp.wtf-hardware.nix ];