0

I tried to connect a remote MongoDB Server running on Ubuntu using MongoDB Compass on Windows. But I have problems connecting always as the IP of the Windows machine changes every day.

I did the following things to connect to the remote server-

  1. Got the IP of the Client Machine, then allowed that IP on the firewall of the server machine on port 27017.
sudo ufw allow from client_machine_ip to any port 27017

Note: The ufw status looked okay.

  1. Got the IP of the Server Machine, then on the MongoDB configuration file on the server, I modified the bindIp.
bindIp: 127.0.0.1,server_machine_ip

Note: I restarted mongod and it was okay too.

I was able to connect the remote MongoDB Server using MongoDB Compass successfully for the first time. Then I saw, the IP of the client machine was changing every day. So, every time, the client IP changes, I need to allow that IP on the firewall of the server machine (in which I am using the MongoDB Server) on port 27017. Could you help to solve this? Thanks in advance.

Shrey
  • 146
  • 10

1 Answers1

0

You can update the firewall for port 27017 to allow from anywhere since client machine IP is not static.

sudo ufw allow 27017 #(this will allow from any IP)
Wylan Osorio
  • 1,136
  • 5
  • 19
  • 46