Question

How to turn on TUN/TAP on droplet server

to run openvpn I need tun/tap, how to start it ?

Already running


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
July 5, 2024

Heya,

I assume this is now sorted, I’ll like to mention the following. Run the following command to see if the TUN device is available:

cat /dev/net/tun

If it returns File descriptor in bad state, it means the TUN/TAP driver is available.

Additionally, once OpenVPN is running, verify the TUN interface is up:

ip a show tun0

You should see an interface named tun0 with an IP address assigned.

Regards

KFSys
Site Moderator
Site Moderator badge
July 2, 2024

Heya,

In case you still need to enable tun/tap,

1. Check if TUN/TAP is Enabled

First, check if the TUN/TAP module is already enabled:

cat /dev/net/tun

If you see the output “File descriptor in bad state”, it means TUN/TAP is enabled. If you see “No such file or directory”, it means TUN/TAP is not enabled.

2. Load the TUN Module

If TUN/TAP is not enabled, you need to load the TUN module:

sudo modprobe tun

You can verify that the module is loaded:

lsmod | grep tun

You should see an output like:

tun 28672 0

3. Ensure TUN/TAP Loads on Boot

To ensure that the TUN module loads on boot, you need to add it to /etc/modules:

echo "tun" | sudo tee -a /etc/modules
Bobby Iliev
Site Moderator
Site Moderator badge
July 2, 2024

Hi there,

Noticed that you mentioned that this is already running? Did you sort it out and if so would you mind sharing this with the community here?

What I personally do when setting up an OpenVPN instance is to use the 1-Click installation from the DigitalOcean Marketplace:

https://marketplace.digitalocean.com/apps/openvpn-access-server

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.