Install NetBird on Proxmox VE

Proxmox VE (Virtual Environment) is an open-source server virtualization platform that combines KVM-based virtualization and LXC containerization. It provides a web-based management interface for deploying and managing virtual machines and containers, making it ideal for running the NetBird agent in a containerized environment.

Installing in an LXC

Downloading a Container Template

Before creating an LXC container, you'll need to download a container template. NetBird runs on a majority of Linux distributions, so you can choose any Linux template you're comfortable with. Popular choices include Ubuntu, Debian, CentOS, Alpine, and others.

To download a container template:

  1. In the Proxmox web interface, navigate to your local storage (usually local or local-lvm)
  2. Click on CT Templates in the left sidebar
  3. Click the Templates button at the top
  4. Browse the available templates and select your preferred Linux distribution
    • For stability, many users prefer LTS versions (e.g., Ubuntu 22.04 LTS)
    • The template list includes various distributions and versions
  5. Click Download next to your chosen template
  6. Wait for the download to complete (this may take a few minutes depending on your internet connection)

Once the template is downloaded, you're ready to create your LXC container.

Container Setup

Once we have a template ready, we can click the "Create CT" button on the top right. Then input all of your settings. If you're only using this container for NetBird, the required specs will be relatively low and you can always change things in the future.

  1. General tab:
    • Set CT ID (e.g., 100)
    • Enter hostname
    • Set password or upload SSH key
    • Setup as unprivileged
  2. Template tab:
    • Select the downloaded template
  3. Disks tab:
    • Set disk size to 8 GB or higher
    • Choose storage location (SSD/NVME storage is best)
  4. CPU tab:
    • Set cores as needed (1-2 cores)
  5. Memory tab:
    • Set memory to 1024 MB (1GB)
    • Set swap as desired (512 MB recommended)
  6. Network tab:
    • Configure network interface (usually bridge vmbr0)
    • Set IPv4 to DHCP to manage with your router or a static IP.
  7. DNS tab:
    • Configure DNS servers if needed
  8. Confirm - Review settings and click "Finish"

The container will be created and ready to start. Head into the options for this LXC and enable the start-on-boot option so this container will automatically run if the Proxmox Node reboots.

Enable /dev/tun Passthrough

TUN provides an interface for user applications, such as NetBird, to deal with the raw network traffic. By default, since we set this up as an unprivileged container, there is no access to this interface. To fix this, we'll need to bind the host's TUN device into the container and grant the container permission to use it. The lines below mount /dev/net and /dev/net/tun from the Proxmox host into the LXC and allow the TUN character device (10:200) so NetBird can create virtual network interfaces inside the container.

Under your main node, access the shell. Find your container number, for example, mine is 100. Use nano or another text editor to open the configuration.

nano /etc/pve/lxc/100.conf 

Now add these lines to the bottom.

lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net dev/net none bind,create=dir
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

Now, restart the container and you can check within the shell for the container to see if the interface is available.

ls /dev/net

Installing NetBird

Before we install NetBird, we are going to want to generate a one-off setup key to use with our LXC installation. While NetBird's documentation offers comprehensive guidance on this process, let's quickly review the essential steps:

  • Access your NetBird dashboard
  • Navigate to the Setup Keys section
  • Click the Create Setup Key button on the right
  • Name your key (e.g., "ProxmoxLXC")
  • Set an expiration date (recommended for enhanced security)
  • Configure auto-assigned groups if needed (e.g., "Homelab")
  • Click Create Setup Key to generate the setup key
  • Copy the generated key and store it securely as you'll need it for the next steps

Access the shell for your container. You can log in as root and use the password from the initial setup wizard. We are going to need to update our system and install curl so the installation script will work. The command below is for Ubuntu/Debian, change this if needed.

apt update && apt upgrade -y && apt install curl -y

Now that our system is updated, we can install NetBird with the following command.

curl -fsSL https://pkgs.netbird.io/install.sh | sh

Now that NetBird is installed, we can connect our peer to our account using the setup key we generated earlier.

  netbird up --setup-key <SETUP KEY>

Now you should see a successful connection message and you're good to go! Now if you want to access your entire network using this LXC with NetBird, check out the docs to learn more about NetBird Networks!

Proxmox Setup Tutorial

Additional Resources

If you want to set up your own Proxmox machine, check out our Knowledge Hub post on Proxmox. This comprehensive guide covers the basics of getting Proxmox up and running, setting up a LXC container with NetBird for remote connectivity, and diving into some more advanced tips and tricks such as setting up a ZFS pool and enabling IOMMU for GPU passthrough.