Connecting to MongoDB community edition from external IP

Need to be able to access data remotely. I have set up port forwarding on my router and also followed a tutorial here

Ufortunately, I am unable to connect and get an error “MongoServerSelectionError: connection timed out”. I have the bindIP set to 0.0.0.0. I have tried everything I can find but I cannot figure this out. I really need help with this. Thanks in advance

Hi @T-roy,

Try bindIpAll instead of 0.0.0.0. Both are terrible solutions but at least this will get out of the way.

Then it can be anything else. Firewall, antivirus, OS misconfiguration, …

Cheers,
Maxime.

Appreciate the reply, @MaBeuLux88 . I tried your idea but still getting the timeout as mentioned above. I know this is a terrible idea, but it’s only temporary until I can find the culprit. Is there any way to set the driver to not timeout when attempting the connection? Or might you have any other possible ideas to this scenario?

You can set the different timeout values in the driver to biggest values. But if you are never able to get a connection through, this isn’t the heart of the problem here.

The issue ended up being that my home network is behind a CGNAT. Spoke with my ISP and they were able to fix this. Also, I had to switch back to 0.0.0.0 instead of ALL as this was not allowing for connection. Thanks @MaBeuLux88 for your guidance.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.