Mongo connection test: DNS name does not exist

I am trying to test connection to the cluster but i always end up getting this error -
“DNSHostNotFound: Failed to look up service “”:DNS name does not exist.”
I have followed all steps prior to this mentioned in the README file.

I have tried with the shell version 4.0.3 and 4.0.4.

I also tried using the connection string for shell versions <3.4. Still unable to connect.

Could it be because of firewall settings since i am using my company’s PC?

Any suggestions here would be helpful.

Well no :slight_smile:

$ nslookup

Non-authoritative answer:
*** Can't find No answer

Looks like the hostname is actually incorrect.

When a connection string starts with mongodb+srv, It indicates the connection uses DNS records. This seed list allows us to abstract all nodes in one replica set member. However, there are still a number of hosts running underlying the abstract. That is why nslookup will not work against this seedlist connection string which has no real IP address. In Atlas, by default there are three actual hosts behind this string. We could try to access one of them.

$ nslookup

Non-authoritative answer:	canonical name =	canonical name =

If you want to use nslookup specifically with srv, you could try

  [root@qi-docker01 ~]# nslookup
> set type=SRV

Non-authoritative answer:	service = 0 0 27017	service = 0 0 27017	service = 0 0 27017


I think you could try to ping one of replica set member. If it fails, maybe the firewall setting is the cause.

Q Yang

1 Like

Thank you die explaining! That makes so much sense! Good stuff :slight_smile:

Hello Team,
I’ve just started the M001 course and tried to connect my Atlas cluster with"Sandbox" name to mongodb Shell
here the command :mongo “mongodb+srv://” --username m001-student --password m001-mongodb-basics
and I got the same error :
DNSHostNotFound: Failed to look up service “”:DNS name does not exist.
actually I saw your replay and it seems working ,but I’m using windows 10 .
can you help please

I can connect to your cluster
Did you whitelist your IP?
Are you able to ping your cluster?
Any firewall or network issues blocking your connection?
Could be a temporary issue
Are you still facing issues in connecting to your cluster?

1 Like