Cannot open TUN/TAP dev /dev/net/tun

Issue: Error message when run open VPN

Oct 20 11:45:51 chemlab1 ovpn-server[1676]: OpenVPN 2.1_rc11 i486-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Sep 1$
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: WARNING: --ifconfig-pool-persist will not work with --duplicate-cn
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: Diffie-Hellman initialized with 1024 bit key
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: WARNING: file 'keys/server.key' is group or others accessible
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: /usr/bin/openssl-vulnkey -q -b 1024 -m
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: ROUTE default_gateway=178.63.161.129
Oct 20 11:45:51 chemlab1 modprobe: FATAL: Could not load /lib/modules/2.6.18-194.11.4.el5xen/modules.dep: No such file or d$
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: Note: Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: Cannot allocate TUN/TAP dev dynamically
Oct 20 11:45:51 chemlab1 ovpn-server[1676]: Exiting


Solution:

load the kernel module (CentOS/Debian)

1) Check if you have the tun module available in your VPS

ls /lib/modules/`uname -r`/kernel/drivers/net/tun.*

It shoud return something like:

/lib/modules/2.6.18-194.26.1.el5xen/kernel/drivers/net/tun.ko

2) If no kernel modules, 

cd /lib/modules

3) Go to http://repos.nethconsulting.com/centos/5/kernel/modules/ to get your required kernel module and wget into your /lib/modules directory. To know your kernel version, simply run uname -r

4) untar the module by running tar -xvzf 2.6.xxxxxxxxx.tar.gz

3) Load TUN with modprobe -a tun or echo "tun" >> /etc/modules and install udev (apt-get install udev) for Debian.

4) reboot the VPS, here we go....

  • 5 Users Found This Useful
Was this answer helpful?

Powered by WHMCompleteSolution