From d5711e7de778b8f2f5e183a3fd32630631c7b806 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 7 Jul 2025 19:49:51 +0000 Subject: [PATCH] netns: set lo up when initializing the netns this is critical for services which communicate with eachother, e.g. jackett -> bitmagnet --- modules/netns.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/netns.nix b/modules/netns.nix index 4e12d0279..8350f8c73 100644 --- a/modules/netns.nix +++ b/modules/netns.nix @@ -87,6 +87,18 @@ let "${ip} netns delete ${name}" ]; }; + systemd.services."netns-${name}-lo" = { + description = "bring loopback device online in '${name}' network namespace"; + wantedBy = [ "netns-${name}.target" ]; + before = [ "netns-${name}.target" ]; + after = [ "netns-${name}.service" ]; + partOf = [ "netns-${name}.service" ]; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = true; + serviceConfig.NetworkNamespacePath = "/run/netns/${name}"; + serviceConfig.ExecStart = "${ip} link set lo up"; + serviceConfig.ExecStop = "${ip} link set lo down"; + }; systemd.services."netns-${name}-veth" = { description = "create a link between ${name} and the parent net namespace which tunnels any traffic explicitly routed to it"; wantedBy = [ "netns-${name}.target" ];