I have installed MongoDB on my CentOS 7.2 VPS and trying to access to the DB via Robomongo from my client. However, when I try to connect the server from the 27017 port, I get "Network is unreachable" error.
I have enabled the firewalld on the server and added an exception for 27017 port.
firewall-cmd --list-all
Result:
I got this result after I've permanently added the exception and reloaded the firewalld via --reload.
When I query the port by using:
firewall-cmd --query-port=27017/tcp
I get a "yes" from the system. However when I try to connect via Robomongo or query the port via a port checker service like http://ping.eu/port-chk/ I get a negative result.
Do you have any suggestions regarding to my case?
Thank you.
I was able to solve the issue with the help of the VPS support team via performing the steps below:
Execute,
ss -plnt
to see the socket statistics. My output was like below:
As can be seen from the result mongod process is listening 27017 port only on 127.0.0.1 . In order to configure that binding edit the mongod.conf in /etc/ directory and comment out the line
bindIp: 127.0.0.1
Restart the mongodb service and everything should be fine.