Expressvp with Ubuntu Container

uviteru

Member
May 21, 2019
24
0
6
39
Hello,

I'm wanting to use ExpressVPN in an Ubuntu container, but I cannot get it to connect. I reached out the ExpressVPN support, and they told me that they don't officially support containers, so they would not help me troubleshoot.

Looking at the diagnostics, this stands out to me:

ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)

I think there is some issue creating the tunnel, and searching the forums, I found a similar issue (a new user can't post external links, so I will summarize what they suggested):

Add the following to your container config file in /var/lib/lxc/[container]/config


lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file


I tried to edit my config file, but it appears to get overwritten every time I launch the container, so I found this thread about adding to the config file so that it will persist, but I don't know the proper syntax to add the tunnel adapter.

Does anyone have any idea how to do this?
 
ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)


You have to add in file /etc/pve/lxc/<ct-id>.conf
Code:
lxc.cgroup.devices.allow: c 10:200 rwm
and to run in the container (e.g. putting the following into /etc/rc.local):
Code:
mkdir -p /dev/net
mknod -m 666 /dev/net/tun c 10 200
 
Thank you so much--that worked!

I couldn't get the rc.local part to work though (I just manually ran the command in the container to test it). That file didn't exist before I added those lines, do I need to make another change somewhere to get it to run at startup?
 
Thank you so much--that worked!

I couldn't get the rc.local part to work though (I just manually ran the command in the container to test it). That file didn't exist before I added those lines, do I need to make another change somewhere to get it to run at startup?


Important to give /etc/rc.local execute permission as well as putting
Code:
#!/bin/sh
as first line.
 
Thank you for the quick response!

I added the shell line in rc.local and then made it executable with chmod +x /etc/rc.local

-rwxr-xr-x 1 root root 64 May 22 13:47 /etc/rc.local

But it still does not appear to be running when I restart the container--tun is not listed as a network interface.
 
hi.

you can try doing the same thing in the lxc config to initialize the tun interface (basically running the same commands with autodev)

Code:
lxc.hook.autodev = sh -c "modprobe tun; cd ${LXC_ROOTFS_MOUNT}/dev; mkdir net; mknod net/tun c 10 200; chmod 0666 net/tun"

restart the container after adding this line. if that doesn't work, send your container config here (`pct config CTID`)
 

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!