Skip to content

Instantly share code, notes, and snippets.

@ngoc-minh-do
Last active January 11, 2026 06:27
Show Gist options
  • Select an option

  • Save ngoc-minh-do/cbde5f6163d0afc80ef8a903d3b53f3d to your computer and use it in GitHub Desktop.

Select an option

Save ngoc-minh-do/cbde5f6163d0afc80ef8a903d3b53f3d to your computer and use it in GitHub Desktop.

Proxmox: Passing Host Devices into LXC Containers

This document explains common ways to pass host devices into Proxmox LXC containers. Examples use /dev/net/tun.

Applies to: Proxmox VE with LXC (cgroup v2)


Option 1: Bind-mount a Device (Classic / Manual Way)

This method is useful for advanced or legacy setups. For most cases, Option 2 is recommended.

1. Check device information on the host

ls -lah /dev/net

Example output:

total 0
drwxr-xr-x  2 root root      60 Jan 11 08:37 .
drwxr-xr-x 22 root root    4.9K Jan 11 08:37 ..
crw-rw-rw-  1 root root 10, 200 Jan 11 09:37 tun
  • Major number: 10
  • Minor number: 200
  • Type: c (character device)

2. Modify the LXC config

Edit /etc/pve/lxc/<lxc-id>.conf, add:

lxc.cgroup2.devices.allow: c 10:200 rwm

lxc.mount.entry: /dev/net dev/net none bind,optional,create=dir
# or
lxc.mount.entry: /dev/net/tun /dev/net/tun none bind,optional,create=file
Explanation

lxc.cgroup2.devices.allow

  • Allows the container to access a specific device.
  • c → character device
  • 10:200 → major:minor number
  • rwm permissions:
    • r = read
    • w = write
    • m = mmap (required by many drivers)

lxc.mount.entry

  • Bind-mounts the host’s /dev/net directory into the container at /dev/net (or /dev/net/tun file).
  • optional: Do not fail container startup if the source path is missing. (useful for hot-plug or non-critical devices).

3. Restart the container

pct restart <lxc-id>

Option 2: Proxmox Device Passthrough (Recommended / New Way)

Proxmox provides a simpler syntax that automatically handles:

  • cgroup permissions
  • bind mounts
  • ownership inside the container

Edit /etc/pve/lxc/<lxc-id>.conf, add:

dev0: /dev/net/tun,gid=0,uid=0
Explanation
  • dev0
    • Arbitrary index (dev0, dev1, …)
  • /dev/net/tun
    • Device path on the host
  • uid (optional)
    • User ID owning the device inside the container
  • gid (optional)
    • Group ID owning the device inside the container

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment