I am trying to bind multiple IP to mongodb config file, one is and other is I did the following change in configuration file


# network interfaces
  port: 27017
  bindIp: ","

Than I reloaded the configuration by the following command

sudo mongod --config /etc/mongod.conf

Than checked if the server is listening on localhost as well or not by the following command.

netstat -tlpn

It shows the output only for

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0    *               LISTEN      -
tcp        0      0 *               LISTEN      -

Why is it not listening to localhost as well?

  • 4
    The IP address means all IP v4 addresses (which includes You could achieve the same outcome by not specifying any bindIp address, as "bind to all IP addresses" is the default behaviour as at MongoDB 3.2. Have you tried connecting to mongod via localhost, and if so was there any error? What are you trying to achieve with multiple IP addresses? The bindIp configuration determines what IP address(es) mongod listens on if your server has multiple addresses, but you still need to configure appropriate firewall settings.
    – Stennie
    Nov 29, 2015 at 3:21

2 Answers 2


had the same issue and the thing is everywhere it's written that you have to bind them like this

bindIp :,

but that doesn't work.

The MongoDB version 3.2.x have the following configuration and its working for me.

    bindIp : [,]

    example :

# network interfaces
      port: 27017
      bindIp : [,,]

The IP addresses and/or full Unix domain socket paths on which mongod should listen for client connections. You may attach mongod to any interface. To bind to multiple addresses, enter a list of comma-separated values.


WARNING: Before you bind to other ip addresses, consider enabling access control and other security measures listed in Security Checklist to prevent unauthorized access.

Note: Starting in MongoDB 3.6, mongod bind to localhost ( by default. See Default Bind to Localhost.

To bind to all IPv4 addresses, enter

To bind to all IPv4 and IPv6 addresses, enter,:: or alternatively, use the net.bindIpAll setting.

Note : --bind_ip and --bind_ip_all are mutually exclusive. That is, you can specify one or the other, but not both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.