PDA

View Full Version : How to activate/enable Tun/Tap on the OpenVZ node/VPS



Fli
01-12-2015, 10:33 AM
How one can make Tun/Tap working on an OpenVZ based VPS and OpenVZ VPS Node?

First on a VPS i got error:

# cat /dev/net/tun
cat: /dev/net/tun: Operation not permitted

So im running this script on OpenVZ host node:

lsmod | grep tun
modprobe tun
vzlist
echo "The CTID where to enable tun:"
read CTID
vzctl set $CTID --devnodes net/tun:rw --save
vzctl set $CTID --devices c:10:200:rw --save
vzctl set $CTID --capability net_admin:on --save
vzctl exec $CTID mkdir -p /dev/net
vzctl exec $CTID mknod /dev/net/tun c 10 200
vzctl exec $CTID chmod 600 /dev/net/tun

Then i see this on an OpenVZ VPS:

# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state

but i saw someone said this is OK to appear..