I'm trying to set up an OpenVPN server on my VPS for myself when I'm in public places, using this tutorial, http://tipupdate.com/how-to-install-openvpn-on-ubuntu-vps/

However whenever I try to start the server, it gives me this,

root@vps:~# /etc/init.d/openvpn start
 * Starting virtual private network daemon(s)...                                                                 *   Autostarting VPN 'server'                                                                           [fail]

The log contains this

Tue Dec 11 10:53:32 2012 Diffie-Hellman initialized with 1024 bit key
Tue Dec 11 10:53:32 2012 /usr/bin/openssl-vulnkey -q -b 1024 -m <modulus omitted>
Tue Dec 11 10:53:33 2012 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue Dec 11 10:53:33 2012 ROUTE: default_gateway=UNDEF
Tue Dec 11 10:53:33 2012 Note: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Tue Dec 11 10:53:33 2012 Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Tue Dec 11 10:53:33 2012 Cannot allocate TUN/TAP dev dynamically
Tue Dec 11 10:53:33 2012 Exiting

So obviously it's something to do with the tun, but I don't understand how to fix it.

Thanks!

up vote 5 down vote accepted

You are using an OpenVZ-based VPS provider. The provider must enable TUN/TAP in your container before you will be able to use OpenVPN (or anything else that relies on TUN/TAP).

You have not /dev/net/tun node in your /dev directory.

Try to create it:

cd /dev
mkdir net
cd net
mknod tun c 10 200
chmod 666 tun

Or you can try, according to this article, use this command: openvpn --mktun

If will openvpn still complain about non-existent tun interface, try use modprobe tun command. But on mine Ubuntu have kernel support for tun interface compiled in.

  • 1
    modprobe tun did it for me, Debian Jessie. – Nobody Jan 10 at 21:58
  • Does not work on an OpenVZ VPS, the error will change to Cannot open TUN/TAP dev /dev/net/tun: Operation not permitted – Taha Jahangir May 21 at 7:24

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.