MongoDB Atlas using Compass doesn’t like you to connect over a VPN so sometimes may not work.

Lets say the URL you are connection to is cluster0.2a86itv.mongdb.net.

Bypassing the domain cluster0.2a86itv.mongdb.net from the VPN wont be enough because of the cluster.

First run the following command to see what servers its really using:

$ nslookup -type=SRV _mongodb._tcp.cluster0.2a86itv.mongodb.net

Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
_mongodb._tcp.cluster0.2a86itv.mongodb.net      service = 0 0 27017 ac-f9b6kia-shard-00-02.2a86itv.mongodb.net.
_mongodb._tcp.cluster0.2a86itv.mongodb.net      service = 0 0 27017 ac-f9b6kia-shard-00-00.2a86itv.mongodb.net.
_mongodb._tcp.cluster0.2a86itv.mongodb.net      service = 0 0 27017 ac-f9b6kia-shard-00-01.2a86itv.mongodb.net.

Authoritative answers can be found from:

Second and last add those domains to bypass the VPN. Recommend to bypass only TPC traffic going to port 27017

In this example:

  • ac-f9b6kia-shard-00-02.2a86itv.mongodb.net
  • ac-f9b6kia-shard-00-00.2a86itv.mongodb.net
  • ac-f9b6kia-shard-00-0a.2a86itv.mongodb.net