2

I am running a MongoDB service on port 27017 on a server. Both of:

lsof -i
netstat -a

Show that port 27017 is listening. I can connect to the service locally, but when I try to connect from an external machine the connection is refused. Running nmap on the port locally shows it as open, but running externally shows closed. I have completely reset the iptables and allowed connection via port 27017, and ufw is disabled. The mongodb config is set to allow access from all ips. What am I missing here?

  • 2
    Please add Unix/Linux version, and the relevant netstat output to the question. It is also not clear wether this is a machine with a private IP address space, and if you are trying to connect to it from the Internet. – Rui F Ribeiro Apr 22 '17 at 17:35
  • 2
    Also did you make sure that it is listening on its external ip address as well as the loopback address. Some netstat or lsof output would really help. – farhangfarhangfar Apr 22 '17 at 17:49
  • Please add the contents of the MongoDB config file also, you may have bindIp configured incorrectly (for example). The output of iptables -L and the information the others have asked for would help nail this down – Adam C Jun 12 '17 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.