Question

Why can't I access my droplet after it connects to an openvpn server?

I have an openvpn server on a third party network. I want to connect a droplet server to a NAS on the VPN, but whenever I connect to the vpn from my droplet, I can no longer access the server. Why is that? How can I setup my droplet server to be able to connect to the vpn, while maintaining the server connections and services it normally hosts?


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
May 26, 2023

When connecting your Droplet to a VPN, it’s common to lose external connectivity if your VPN configuration pushes a default route to the client. This causes all your Droplet’s traffic to be routed through the VPN, affecting your server’s regular connections and services.

To fix this issue, you should configure your OpenVPN server to provide only specific routes to your Droplet. This ensures that your Droplet maintains its connections and services while still accessing the NAS over the VPN.

On your OpenVPN server configuration file, comment out or remove the line “push "redirect-gateway def1"” if it exists. Then, add a line with the specific network route to the NAS, like this:

push “route nas_network_address netmask

Replace nas_network_address and netmask with appropriate values for your network.

After making these changes, restart your OpenVPN server and reconnect your Droplet to the VPN.

For more information on configuring OpenVPN, you can refer to the following DigitalOcean tutorial: How To Set Up an OpenVPN Server on Ubuntu 20.04.

Hope that this helps!

Select Create OpenVPN Access Server Droplet from the menu. Select a plan and datacenter for your droplet on DigitalOcean. Decide on your authentication. Add tags, choose a project, pick any other parameters, and alter the droplet’s hostname if necessary. To create a droplet, click.

Try DigitalOcean for free

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

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel