Search for:

Available article translations:

[How to] Configure TUN/TAP devices inside a container to install VPN software

Article ID: 696, created on Oct 6, 2008, last review on Sep 12, 2014

  • Virtuozzo 6.0
  • Virtuozzo containers for Linux 4.7
  • Virtuozzo hypervisor


Follow the steps below to configure the TUN/TAP device in the container (all actions should be done on hardware node's side):

  1. Make sure the tun module is loaded on the hardware node:

    ~# lsmod | grep tun
    tun                    18979  0

    If the module is not loaded:

    • For RHEL 4/5-based distributions

      Create a separate file /etc/init.d/addtun, link it to the proper runlevel and make it executable:

      ~# cat /etc/init.d/addtun
      /sbin/modprobe tun
      ~# ln -s /etc/init.d/addtun /etc/rc3.d/S10addtun
      ~# chmod +x /etc/init.d/addtun

      At next server reboot tun module should be loaded.

    • For RHEL/CentOS 6.x based distributions

      Create a separate file /etc/sysconfig/modules/vztun.modules to let it load automatically during the boot time:

      ~# cat /etc/sysconfig/modules/vztun.modules
      /sbin/modprobe tun

      This file should be executable. You can make it executable by running:

      ~# chmod +x /etc/sysconfig/modules/vztun.modules

      After that restart Virtuozzo service is required as module tun is supposed to be loaded before the Virtuozzo service is started.

      ~# service vz restart

      To let Virtuozzo acknowledge this module's availability (all containers will be restarted).

    • On SuSE-based systems

      Add the tun module into the MODULES_LOADED_ON_BOOT variable in the /etc/sysconfig/kernel file (it should be processed by the /etc/init.d/boot.loadmodules initialization script).

  2. Allow the container to use the TUN/TAP device:

    ~# vzctl set $CTID --devnodes net/tun:rw --save
  3. Set capability:

    ~# vzctl set $CTID --capability net_admin:on --save
  4. Install VPN software, which requires TUN/TAP interface such as Virtual TUNnel or OpenVPN.

Search words:

up tun device


TUN/TAP device

a26b38f94253cdfbf1028d72cf3a498b 2897d76d56d2010f4e3a28f864d69223 e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 0c05f0c76fec3dd785e9feafce1099a9 0dd5b9380c7d4884d77587f3eb0fa8ef c62e8726973f80975db0531f1ed5c6a2

Was this article helpful?
Tell us how we may improve it.
Yes No
Server Virtualization
- Odin Cloud Server
- Odin Containers for Windows 6.0
- Odin Virtuozzo Containers
- Odin Automation
- Odin Automation for Cloud Infrastructure
- Odin Business Automation Standard
- Odin Virtual Automation
- Odin Plesk Panel Suite
- Web Presence Builder
- Odin Plesk Automation
- Odin Small Business Panel
- Value-added Services for Hosters
- Odin Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification