Wednesday, 24 July 2013

Enable TUN/TAP in OpenVZ

For installing TUN/TAP for a OpenVZ vps, you should first make sure that the module is enabled in the node.

For this you need to run the command bellow.
# lsmod | grep tun
 If the module is not installed, just install it by running
# modprobe tun
Now to enable the module to the vps, run the following commands. Replace Veid with your vps id

# vzctl set Veid --devnodes net/tun:rw --save
# vzctl set Veid --devices c:10:200:rw --save
# vzctl stop Veid 
# vzctl set Veid --capability net_admin:on --save
# vzctl start Veid
# vzctl exec Veid mkdir -p /dev/net
# vzctl exec Veid chmod 600 /dev/net/tun
Now TUN/TAP is enabled for the vps. To check this get into the vps.
# vzctl enter Veid
Now run the following command in the vps.
# cat /dev/net/tun
 The result of the above command should be
cat: /dev/net/tun: File descriptor in bad state

No comments:

Post a Comment