MilesWeb Hosting Forum

Web Hosting Technical Support => How To's => Topic started by: Rahul Sambre on June 22, 2016, 05:46:00 PM

Title: How to Enable TUN/TAP Module in OpenVZ.
Post by: Rahul Sambre on June 22, 2016, 05:46:00 PM
Hi,

Login on node by using SSH.
OpenVZ supports VPN inside a container via kernel TUN/TAP module and device. To allow VPS #101 to use the TUN/TAP device the following should be done.

Replace #101 - VPS  id with your VPS id.
Make sure the tun module has already loaded on the Node bu using below command.

Quotelsmod | grep tun

If not listed, then load the tun module with the below command.

Quotemodprobe tun

Quotelsmod | grep tun

Run the below command in Node.

Quotevzctl set 101 --devnodes net/tun:rw --save

Quotevzctl set 101 --devices c:10:200:rw --save

Quotevzctl stop 101

Quotevzctl set 101 --capability net_admin:on --save

Quotevzctl start 101

Quotevzctl exec 101 mkdir -p /dev/net

Quotevzctl exec 101 chmod 600 /dev/net/tun

To check TUN/TAP is enabled or not by using below command.

Quotevzctl enter 101

Inside the VPS run below command.

Quotecat /dev/net/tun

It will show "cat: /dev/net/tun: File descriptor in bad state" It means the TUN/TAP is enabled on your VPS.

If you receive like this "cat: /dev/net/tun: No such device" Then the TUN/TAP has not enabled on your VPS. Try to enable TUN/TAP again and check.

That's it.  :)