Netbird Management Server Inside LXC

Hi Guys and Girls,
I’m from Germany and new here. I hope you can help me with my current (and maybe future) Problems

Disclamer:
I use ChatGPT to make the text better readable

Describe the problem

I am currently setting up a self-hosted NetBird environment.

Besides the NetBird management server, I want to run a dedicated exit node and several additional nodes that connect to conventional commercial VPN providers and my phone (through regular WireGuard) on the same VPS.

In addition to my own exit, I would like to have separate nodes connected to different commercial VPN providers, so that I can selectively route traffic from specific devices through a particular VPN provider when needed.

One of the main questions I am trying to solve is how to structure this setup cleanly.

I tried to set up a second Docker Stack beside the Management Stack, but if I start the Docker with the Node, it kills my Server.

I tried to troubleshoot this with ChatGPT, and my conclusion is that it is not possible to run these Docker stacks side by side. So, on my VPS, the only way seems to be to use LXC instead.

But I’m unsure whether the Management Stack will work properly inside the LXC.

So my question is: Has anyone here done the same or something similar, and is it really as easy as “just do it inside an LXC”, or should I expect problems with the Management Stack?

To Reproduce

Try to run a Client Docker beside the Management Docker Stack

Expected behavior

See above (run some Nodes beside the Management-Server)

Are you using NetBird Cloud?

No, I host it by my own on a VPS

NetBird version

netbird version = 0.79

Is any other VPN software installed?

No

Debug (output)

The following is a summary from ChatGPT after the Troubleshooting I tried with the help of LLM:

The container runs with:

  • network_mode: host

  • NET_ADMIN, SYS_ADMIN, SYS_RESOURCE

  • /dev/net/tun

  • NetBird 0.79.0

The VPS itself is secured with iptables-nft and has IPv4/IPv6 forwarding enabled.

During the first start, shortly before the VPS became unreachable, the following was logged:

Routing setup complete
creating an nftables firewall manager

After that, the entire VPS became unreachable.

After restoring a snapshot, I started the container again, this time with:

NB_DISABLE_FIREWALL=true

This is also confirmed by NetBird:

firewall is disabled

Nevertheless, the VPS becomes unreachable again when the container starts.

This time, the following additionally appears beforehand:

Error setting up sysctl:
write sysctl net.ipv4.conf.all.src_valid_mark:
open /proc/sys/net/ipv4/conf/all/src_valid_mark:
read-only file system

NetBird then continues starting:

Routing setup complete
Netbird engine started
Interface monitor: watching wt0
Connected

My suspicion at this point is therefore that the NetBird firewall is not primarily causing the problem, but rather that the exit node, through network_mode: host, is making routing/network changes directly to the network stack of the VPS.

Additional context

nothing to add yet

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings

You cannot run Netbird as an exit node on the management server, the management server has to run as it’s own seperate machine as it decides who can and can’t connect, and it’s what all clients connect to. While adding it as a node is no problem, making it an exit node makes the networking a big more confusing and harder to manage.

Furthermore, the LXC stack doesn’t 100% support docker without some hacky and insecure ways to do it. Either KVM it or get a second machine.