Add manual network namespaces to systemd

This commit is contained in:
Natsu Kagami 2025-04-09 00:41:26 +02:00
parent 17a58f1e7e
commit b59f21a8cc
Signed by: nki
GPG key ID: 55A032EB38B49ADB

View file

@ -357,6 +357,17 @@ in
# Firewall: only open to SSH now # Firewall: only open to SSH now
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ 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 and Region
time.timeZone = lib.mkDefault "Europe/Zurich"; time.timeZone = lib.mkDefault "Europe/Zurich";