SysAdmin

Enable TUN / TAP in OpenVZ

JJ
Jobin Joseph · Founder and CEO
·Published 8 September 2015·1 min read

Issue

You have an OpenVZ VPS and you are getting the following error.

[root@vps ~]# cat /dev/net/tun
cat: /dev/net/tun: No such device

Fix

Makes sure you have TUN / TAP enabled on the Hardware node.

lsmod | grep tun

If it didnt return anything, run the below and make sure the module is loaded.

lsmod | grep tun

From your OpenVZ Hardware node, Run the below to enable TUN/TAP for the VPS. Note : CTID is the ID you get from the command

vzlist -a – Stop the VPS by running

vzctl stop CTID 

Then run,

vzctl set CTID --devnodes net/tun:rw --capability net_admin:on --save

– Then start the vps by running,

vzctl start CTID 
vzctl enter CTID 
[root@vps ~]# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state

The above message means, Your VPS has now TUN/TAP enabled.

Jobin Joseph
Jobin Joseph, Founder and CEO
5x AWS Certified, ISO 27001:2022 Lead Implementer, 17+ years building cloud infrastructure for regulated industries.
About Jobin →

Reading this because your AWS bill or uptime is a problem?

30 minutes, direct with the founder, no sales pitch: one specific recommendation for your AWS workload.

Book a free 30-minute review
30 min Free Consultation →