MilesWeb
MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length

 

News:

SMF - Just Installed!


Author Topic: How to Enable TUN/TAP Module in OpenVZ.  (Read 4712 times)

0 Members and 1 Guest are viewing this topic.

Offline Rahul Sambre

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
    • View Profile
How to Enable TUN/TAP Module in OpenVZ.
« 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.

Quote
lsmod | grep tun

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

Quote
modprobe tun

Quote
lsmod | grep tun

Run the below command in Node.

Quote
vzctl set 101 --devnodes net/tun:rw --save


Quote
vzctl set 101 --devices c:10:200:rw --save

Quote
vzctl stop 101

Quote
vzctl set 101 --capability net_admin:on --save

Quote
vzctl start 101

Quote
vzctl exec 101 mkdir -p /dev/net

Quote
vzctl exec 101 chmod 600 /dev/net/tun

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

Quote
vzctl enter 101

Inside the VPS run below command.

Quote
cat /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.  :)

MilesWeb Hosting Forum

How to Enable TUN/TAP Module in OpenVZ.
« on: June 22, 2016, 05:46:00 PM »