Having issues creating a tap/tun device on an LXC container

headcase

New Member
Jul 7, 2019
10
0
1
39
I'm having some trouble getting a tun/tap device created on a Debian LXC container. I've read through some of the other posts users have made on the subject (I'll link to them at the bottom), but the solutions do not seem to work for me.

The configuration of my container looks like this.
Code:
cat /etc/pve/lxc/100.conf
arch: amd64
cores: 1
hostname: debian
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=92:78:93:D5:EF:28,ip=dhcp,ip6=dhcp,type=veth
ostype: debian
rootfs: mount:100/vm-100-disk-0.raw,size=20G
swap: 512
unprivileged: 1
lxc.cgroup.devices.allow = c 10:200 rwm
lxc.mount.entry: /dev/net/tun /dev/net/tun none bind create=file

The /dev/tun doesn't appear to on the container when I restart it. I'm also unable to use make the device.

Code:
root@proxmox:~# pct enter 100
root@debian:~# modprobe tun
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.15.18-17-pve/modules.dep.bin'
modprobe: FATAL: Module tun not found in directory /lib/modules/4.15.18-17-pve
root@debian:~# mknod /dev/net/tun c 10 200
mknod: /dev/net/tun: Operation not permitted

Using modprobe tun on the host doesn't seem to return anything, I'm a little at a loss to what I should do here.


https://forum.proxmox.com/threads/installing-openvpn.51565/#post-239247
https://forum.proxmox.com/threads/vpn-issues-ppp-tun-interfaces.54649/#post-251645[/code]
 
Hello there,

I like to point out a few issues:

  1. Modprobe is looking for the tun module inside the container which is leading to 'tun not found' error.
  2. mknod failing is likely because that should be done before the container starts, which looks like to me that configuration file is properly setup with your 1xx.conf file.
  3. modprobe on the host not returning looks like a success, have you verified with lsmod? is /dev/net/tun exists on the host prior to container start? It will bind mount that inside the container.
Regards
 
Hello there,

I like to point out a few issues:

  1. Modprobe is looking for the tun module inside the container which is leading to 'tun not found' error.
  2. mknod failing is likely because that should be done before the container starts, which looks like to me that configuration file is properly setup with your 1xx.conf file.
  3. modprobe on the host not returning looks like a success, have you verified with lsmod? is /dev/net/tun exists on the host prior to container start? It will bind mount that inside the container.
Regards

1 - Well, if I understand what I am trying to do correctly, it is to make the tun module available to the container so that I can create tun/tap device interfaces, right? Please tell me if I am misunderstanding
2 - How do I ensure mknod is run before the container starts?
3 - lsmod | grep tun does not turn up any results. However /dev/net/tun does exist on the host.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!