Getting MongoDB on Linux to listen to remote connections

Make sure in your /etc/mongodb.conf file you have the following line,

bind_ip = 0.0.0.0

http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html


1. Bind IP option

Bind IP is a MongoDB option that restricts connections to specifics IPs.

Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:

  1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
  2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!

More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp

Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip

2. Firewall

Check that you are not running behind a firewall