Connect ETIMEOUT connecting to remote server windows

My client is a Windows 10 Education and my server is a Windows Server 2022. My client IP is 192.168.1.222 and my server IP is 192.168.1.163. I am using the default port 27017 for my connection, but I cannot connect to my MongoDB server. I have no idea what’s going on. I am following every guide out there and nothing has been able to fix my issue.

Here is my mongo.cfg from the server:

storage:
  dbPath: C:\Program Files\MongoDB\Server\6.0\data
  journal:
    enabled: true

systemLog:
  destination: file
  logAppend: true
  path: C:\Program Files\MongoDB\Server\6.0\log\mongod.log

net:
  port: 27017
  bindIp: 0.0.0.0

security:
  authorization: enabled

I run ipconfig on my client and I get this:

Windows IP Configuration


Unknown adapter ProtonVPN TUN:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter vEthernet (Ethernet):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::8eba:157b:5e9c:976%42
   IPv4 Address. . . . . . . . . . . : 172.18.0.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (VirtualBox Host):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::6e20:d83d:b51e:fa3b%47
   IPv4 Address. . . . . . . . . . . : 172.21.64.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.1.222
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

I run ipconfig on my server and I get this:

Windows IP Configuration

Ethernet adapter vEthernet (Broadcom NetXtreme Gigabit Ethernet - Virtual Switch):

   Connection-specific DNS Suffix  .  :
   Link-local IPv6 Address.  .  .  .  : fe80::151f:aad0:9a3:2dd1%15
   IPv4 Address  .  .  .  .  .  .  .  : 192.168.1.163
   Subnet Mask.  .  .  .  .  .  .  .  : 255.255.255.0
   Default Gateway  .  .  .  .  .  .  : 192.168.1.1

The firewall on my client has an outbound rule for port 27017 and the firewall on my server has an inbound rule for port 27017. The connection string that I use to connect is: mongodb://192.168.1.163:27017/?tls=true

Hi @Alex_Micharski and welcome to the MongoDB community forum!!

Can you confirm if you have tried to connect using mongodb://localhost:27017 on the server machine to connect to the Mongo client and if the connection was successful?

Also, would recommend you to follow the documentation on how to install MongoDB on Windows for further reference.

If the problem persist, can you help me with a few details about the deployment:\

  1. The mongod.conf file.
  2. Was this working previously and suddenly stopped working? If yes, can you confirm is something was changed between using the previous and the latest version?
  3. The error message received while trying to connect to the client.

As as a recommendation, you can also consider moving to MongoDB Atlas which is fully managed MongoDB in the cloud and solves the complexity of IP networking and routing scenarios.

Let us know if you have any further queries.

Regards
Aasawari