Get Mongo Atlas shared cluster IP address

Is is possible to get the IP of a shared cluster in MongoDB Atlas?

I need the IP so that I can whitelist it for bypassing my VPN, that at moment is blocking it.

The domain of my cluster is “cluster0.xxxxx.mongodb.net”.
I’ve tried the following but with no success

host cluster0.xxxx.mongodb.net // No answer
nslookup cluster0.xxxxx.mongodb.net // No answer
ping cluster0.xxxxx.mongodb.net // ping: cannot resolve cluster0.xxxxx.mongodb.net: Unknown host

Thank you

Hi @x81da - Welcome to the community.

I need the IP so that I can whitelist it for bypassing my VPN, that at moment is blocking it.

Unfortunately it’s difficult to provide the actual IP of the nodes for a cluster in MongoDB Atlas since Atlas is a hosted service, and consequently the actual physical deployment details are constantly changing to provide you with the best service experience. Is there a particular reason the DNS is not resolving the IP’s? I ask this as the best way to connect is to use a hostname instead of IP.

This appears to be an outgoing restriction implemented at the VPN level so I would suggest perhaps contacting your networking team to see if they’re able to assist you with this connection.

Regards,
Jason

1 Like

I would like to add.

In the commands you used, host, nslookup and ping, you assumed that a cluster is an host that has DNS records of type A.

However, a cluster is not an host, it is a group of hosts, it has many IP addresses (that may change dynamically) as specified by its seed list. Read about SRV DNS at https://www.cloudflare.com/learning/dns/dns-records/dns-srv-record/ to see why your commands did not work and why you should use DNS rather than IP in your VPN setup.

2 Likes

Thanks for the clarification. Apparently the VPN I am using (ProtonVPN) is blocking all the traffic to well known port of databases, like, in this case, 27017.

Do you know if it is possible to change the port for the cluster. I am guessing already the answer is no.

Hi @x81da,

It is not possible to change the port for the cluster. You may wish to also check out the following documentation regarding port ranges for different types of connections if you choose to configure these in the future:

Regards,
Jason

2 Likes