How to use a vps server as a wan port of a local network?

Hello, I explain better my concern. I have a local network with applications installed on several servers, my ISP cannot provide me with a static IP address, but I need to access my network when I am not at home, I would like to know how to join my web server locally for example from the IP address of my online VPS? I tried with openvpn and port forwading, but not being an expert I’ve been going around in circles for days and I’m treading water. the vps runs on ubuntu as well as the web server.

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.

Site Moderator
Site Moderator badge
April 6, 2023

Hey @77f88222b72c45e7bd4cd2f2d95185,

To access your local network from your VPS, you can set up a VPN connection between your VPS and your local network. Here’s how you can do it:

  1. Set up a VPN server on your VPS: You can use any VPN server software that is compatible with your VPS operating system. OpenVPN is a popular choice for Ubuntu. You can follow a guide on how to set up OpenVPN server on Ubuntu.

  2. Configure your local network to connect to the VPN server: You’ll need to install an OpenVPN client on your local network devices and configure them to connect to your VPS’s OpenVPN server. You can follow a guide on how to set up OpenVPN client on Windows, macOS or Linux.

  3. Configure port forwarding on your router: You’ll need to set up port forwarding on your router to allow VPN traffic to pass through to your VPS. You need to forward the UDP port that you specified when setting up OpenVPN server on your VPS.

  4. Test your connection: Once you’ve completed the above steps, you can test your VPN connection to ensure that you can access your local network from your VPS.

Note that if your ISP is using Carrier-grade NAT (CGNAT), you may not be able to set up port forwarding, which will prevent you from accessing your local network remotely. In this case, you may need to consider using a VPN service that provides a static IP address or setting up a reverse SSH tunnel.

Try DigitalOcean for free

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

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

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

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
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