Enable TUN / TAP in OpenVZ

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 
  • 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
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top