[Unit] Description=Named network namespace "%i" network config BindsTo=netns@%i.service After=netns@%i.service StopWhenUnneeded=true [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=/etc/systemd/network/netns/netns-%i-interface.conf ExecStart=/sbin/ip link add ${ROOT_NS_INTF_NAME}-%i type veth peer name ${IN_NS_INTF_NAME}-%i ExecStart=/sbin/ip link set ${IN_NS_INTF_NAME}-%i netns %i ExecStart=/sbin/ip addr add ${ROOT_NS_INTF_IP} dev ${ROOT_NS_INTF_NAME}-%i ExecStart=/sbin/ip link set ${ROOT_NS_INTF_NAME}-%i up ExecStart=/sbin/ip netns exec %i ip addr add ${IN_NS_INTF_IP} dev ${IN_NS_INTF_NAME}-%i ExecStart=/sbin/ip netns exec %i ip link set ${IN_NS_INTF_NAME}-%i up ExecStart=/sbin/ip netns exec %i ip link set lo up ExecStop=/sbin/ip link del ${ROOT_NS_INTF_NAME}-%i