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 mflix-cbfye.mongodb.net
Server:		10.0.0.1
Address:	10.0.0.1#53

Non-authoritative answer:
*** Can't find mflix-cbfye.mongodb.net: 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 mflix-shard-00-00-cbfye.mongodb.net
Server:		192.168.1.2
Address:	192.168.1.2#53

Non-authoritative answer:
mflix-shard-00-00-cbfye.mongodb.net	canonical name = mtm-aws-apsouth1-0-m0-6-shard-00-00-v3k13.mongodb.net.
mtm-aws-apsouth1-0-m0-6-shard-00-00-v3k13.mongodb.net	canonical name = ec2-13-127-65-58.ap-south-1.compute.amazonaws.com.
Name:	ec2-13-127-65-58.ap-south-1.compute.amazonaws.com

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

  [root@qi-docker01 ~]# nslookup
> set type=SRV
> _mongodb._tcp.mflix-avw5t.mongodb.net
Server:		192.168.1.2
Address:	192.168.1.2#53

Non-authoritative answer:
_mongodb._tcp.mflix-avw5t.mongodb.net	service = 0 0 27017 mflix-shard-00-00-avw5t.mongodb.net.
_mongodb._tcp.mflix-avw5t.mongodb.net	service = 0 0 27017 mflix-shard-00-01-avw5t.mongodb.net.
_mongodb._tcp.mflix-avw5t.mongodb.net	service = 0 0 27017 mflix-shard-00-02-avw5t.mongodb.net.

@Sudarshan_67389

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://sandbox-sl3qq.mongodb.net/test” --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
Regards

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