Accessing Database (MongoDB / MySQL) using a VPN

I have a MongoDB instance I’ve setup, and under Trusted Sources, all works great. You can add an IP to connect, which may be your local machine, or the web server you’re using.

Since we’re in development, and don’t have a deployed application, we tend to simply add our IP address to the trusted source so our local application connects.

The Problem is however when we’re running a VPN on our local machine, and checking the current ip… it has one address… but then within DigitalOcean, (adding an IP to trusted source) it has a completely different IP. It will say ‘your computers IP’.

Is there a way to get this to work, or is it impossible via a VPN to add an IP to a trusted source that would connect?

Submit an answer
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
November 3, 2022

Hi there,

It would really depend on how your VPN is configured, for example, your VPN might be filtering only some websites and not all of the traffic would be going over the VPN.

What I could suggest is getting in touch with your VPN provider and asking them for the IP range that you get assigned, and then using that IP range in your trusted sources list.

Let me know how it goes!