Help with Self-hosting mongodb + DDNS remote access

Hi all, I have everything setup, i have a no-ip account, setup a windows mongodb server, which works well in my local network.

Now i want to allow remote access to my local mongodb server using a no-ip account …i have configured port-forwarding on my router to my local windows ip address.

the windows server has ip binding to 0.0.0.0, and i allowed port 27017 through the windows firewall.

then in my connection string i am specifying the domain name provided by no-ip something like mydomain:27017

i expect that outside connections to this mydomain will be routed to my internal windows ip, and then the windows mongodb server should be able to respond back.

To reiterate, the server is working fine on the local network, I just can’t seem to get it to work remotely with a DDNS domain name despite port forwarding and all…

Hopefully someone could help me out…

Welcome to the community @Shawn_Law!

Before exposing your MongoDB deployment to the public internet using port forwarding, I strongly recommend reviewing the MongoDB Security Checklist and implementing essential security measures including enabling access control, configuring authentication, and enabling TLS/SSL network encryption.

The setup you’ve described should work as long as:

  • The external DNS you’ve configured with no-ip is pointing at the public IP of your router. Check with what's my ip at DuckDuckGo.

  • Your ISP or network provider isn’t blocking inbound connections to the port you plan to use.

  • Your router configuration is set to forward the external port to the correct internal IP and port.

  • The MongoDB deployment on your internal IP is listening on the specified port and IP address. Check that your custom bindIP configuration appears in the output of db.serverCmdLineOpts().parsed in the mongo shell.

  • The computer hosting your MongoDB allows connections from the router’s internal IP (or any IP).

  • You are connecting to your router from an external host.

I suspect the last requirement may be the issue: try connecting from an external host to confirm. Hosts on the internal network should use an internal host name.

If all of these prerequisites seem fine and you’re still having trouble, please confirm the driver/tool version you are trying to connect with, and the specific error message returned.

If you’re just looking to set up a deployment for development or learning purposes, I would also consider using MongoDB Atlas’ free tier as a faster path for setting up a secure public cluster.

Regards,
Stennie