Pages

Sunday, 21 February 2016

linux vps的tun/tap问题

Configuration 
  Create device node:
     mkdir /dev/net (if it doesn't exist already)
     mknod /dev/net/tun c 10 200
  
  Set permissions:
     e.g. chmod 666 /dev/net/tun
     There's no harm in allowing the device to be accessible by non-root users,
     since CAP_NET_ADMIN is required for creating network devices or for 
     connecting to network devices which aren't owned by the user in question.
     If you want to create persistent devices and give ownership of them to 
     unprivileged users, then you need the /dev/net/tun device to be usable by
     those users.

from https://www.kernel.org/doc/Documentation/networking/tuntap.txt
-------------------

OpenVZ Platform

  1. Enter mkdir -p /dev/net
  2. Enter mknod /dev/net/tun c 10 200
  3. Enter chmod 600 /dev/net/tun
  4. Enter cat /dev/net/tun to test whether the TUN/TAP device is available:
    • If you receive the message cat: /dev/net/tun: File descriptor in bad state your TUN/TAP device is ready for use
    • If you receive the message cat: /dev/net/tun: No such device the TUN/TAP device was not successfully created: contact VPSLink Support for assistance
Please note that the TUN/TAP device will be removed if you reinstall your operating system.
from http://wiki.vpslink.com/TUN/TAP_device_with_OpenVPN_or_Hamachi