Resolution
Follow the steps below to configure the TUN/TAP device in the container:1. Make sure the tun module is loaded on the hardware node:
# lsmod | grep tun
tun 18979 0For RHEL3-based distributions load this module if necessary:
# modprobe tunFor RHEL4/5-based distributions put the following line to the config /etc/modprobe.conf:
alias char-major-10-200 tun
For RHEL/CentOS 6.x based distributions create a separate file
/etc/sysconfig/modules/vztun.sh to let it load automatically during the boot time:#!/bin/sh
/sbin/modprobe tunThis file should be executable. You can make it executable by running:
# chmod +x /etc/sysconfig/modules/vztun.shThis module tun is supposed to be loaded before the Virtuozzo service is started, so run
# service vz restart2. Allow the container to use the TUN/TAP device:
# vzctl set 101 --devices c:10:200:rw --saveIn that case, you will receive the following error message:
Note: Cannot set tx queue length on tun0: Operation not permitted (errno=1)
Add required permission:
# vzctl set 101 --capability net_admin:on --save3. Create the device in the container:
# vzctl exec 101 mkdir -p /dev/net
# vzctl exec 101 mknod /dev/net/tun c 10 2004. Set proper permissions for /dev/net/tun:
# vzctl exec 101 chmod 600 /dev/net/tun5. Install VPN software, which requires TUN/TAP interface such as Virtual TUNnel or OpenVPN.