diff --git a/modules/common/linux/default.nix b/modules/common/linux/default.nix index 416f198..c00367b 100644 --- a/modules/common/linux/default.nix +++ b/modules/common/linux/default.nix @@ -357,6 +357,17 @@ in # Firewall: only open to SSH now networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedUDPPorts = [ 22 ]; + # Network namespaces management + systemd.services."netns@" = { + description = "Network namespace %I"; + before = [ "network.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.iproute2}/bin/ip netns add %I"; + ExecStop = "${pkgs.iproute2}/bin/ip netns del %I"; + }; + }; ## Time and Region time.timeZone = lib.mkDefault "Europe/Zurich";