vpntaplxctun

TAP/TUN adapter in LXC container


I am trying to create an lxc container that acts as a vpn server. I am trying to add the tap/tun adapter to the container's device list. I have tried adding the following line to the lxc config.

lxc.cgroup.devices.allow = c 10:200 rwm

That did not seems to add it to the container. I have tried creating the folder

/var/lib/lxc/vm1/rootfs/dev/net and mknod -m 666 /var/lib/lxc/vm1/rootfs/dev/net/tun c 10 200

This does not work as well. Using mknod inside the container throws an error Operation not permitted

Any ideas on how I proceed? I am still new to VPN servers and LXC containers.


Solution

  • I was able to solve it by following the steps here: http://heider.io/blog/2013/10/26/openvpn-in-a-lxc-container/ but I had to add these to the end of configs in /var/lib/lxc/vm1/config

    [Edit] I no longer am in need of this answer, but for other folks looking, the web page is no longer accessible, here is the archive version of it - https://web.archive.org/web/20190730140350/http://heider.io/blog/2013/10/26/openvpn-in-a-lxc-container/ and here is a picture of the contents - picture of the contents