Cannot access cloud DB with VPN

Hello, I set (includes your current IP address)

IP white list as

But I can not access the DB while using my VPN

Please check this kindly

Thank you

Hi @hoyuen_kim,

Welcome to the MongoDB Community forums :sparkles:

Can you please provide any error messages you are receiving when attempting to connect to the database? Also, are you able to access it without the VPN?

Additionally, can you specify from where you are trying to connect, such as your application, mongo shell, MongoDB Compass etc.


MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted. Make sure your current IP address is on your Atlas cluster’s IP whitelist:

And when if I turn off the VPN it works, But using VPN is mandatory for me on company laptop environment, also my localhost is located in company laptop…

this is the error log that I got, Please check this kindly

Hello @hoyuen_kim,

As you are already using the which allows the connection from anywhere.

I suspect the VPN is blocking the connection to your MongoDB Cluster. I’ll suggest contacting your IT department to see if there is a solution that allows you to connect to MongoDB Atlas using the VPN.

Let us know if you have any further queries.


1 Like


You need to specify the URI for the mongodb server and verify configs.

MongoDB Connection scripts for Mongoose I posted in this post here.

Otherwise, your MongoDB configs are off.

/etc/mongod.conf and make sure you update the net.bindIp setting to . and ensure you have firewall with port 27017 open, and MongoDB user with the necessary permissions to access the database over VPN, you need access perms. You also need to make sure you add a route to the VPN configuration to route traffic to the MongoDB server’s IP address.