Enable TUN / TAP in OpenVZ

08. September 2015 SysAdmin 0


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


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 

  • Now login to the VPS, and check the TUN/TAP status

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.

0 0 votes
Article Rating

Notify of
Inline Feedbacks
View all comments