OpenVPN in a lxc container
Recently I’ve been playing with lxc as a lightweight alternative to full blown virtualization and wanted to run OpenVPN in the container.
However, the tun device is not available by default in lxc containers, leading to this error:
As usual there’s a bunch of solutions floating around the net, but due to recent changes to lxc/systemd the old way of creating the tun device inside the container doesn’t work anymore. Instead it has to be created using the autodev hook.
For this, create a script named autodev in /var/lib/lxc/yourcontainer/
1 2 3 4 5 6
and make it executable:
1 2 3 4
More information can be found at https://wiki.archlinux.org/index.php/Lxc-systemd.