Curious network problem between two mongodb nodes

Machine A (bankiz-db 10.20.106.12)
Machine B (srv-oba-proxydigit 10.1.0.192)

On each of the machines I can connect with the mongo shell. but from machine A i can’t connect to machine B mongod and vice versa. However, the port is open on the firewall, there is no authentication on the mongod deamon and a telnet or a netcat on the port shows that the ports is open.

I am at the end of my debugging. in the logs we notice that at each connection attempt of a peer there a socket is opened and immediately closed:
2020-12-19T11: 04: 08.984 + 0000 I NETWORK [listener] connection accepted from 10.1.0.192:48352 # 5 (1 connection now open)
2020-12-19T11: 04: 08.985 + 0000 I NETWORK [conn5] end connection 10.1.0.192:48352 (0 connections now open)

In the screenshot below I am doing obvious tests to show you my problem.

how i started mongod instance on each node ? :
mongod --port 27017 --dbpath /var/lib/mongodb2 --replSet rs1 --bind_ip localhost,the_private_ip_adress

Are you running with no security?

Yes i’m running with no security as by default. I’m not using a config file. So to show all options i have passed pls check my command below:

mongod --port 27017 --dbpath /var/lib/mongodb2 --replSet rs1 --bind_ip localhost,the_private_ip_address_of_my_host

They are on different subnets.

One is on a /16 the other a /24. It is a networking issue.

2 Likes