bindIp not working on ubuntu 16 for MongoDb

I have mongoDb installed on ubuntu ec2 instance and want to allow the connection from other multiple IP, I tried bindIp but it is not working. Following is the code I have in the conf file

net:
  port: 27017
  bindIp: 10.0.1.1,10.0.1.2

I tried following too but none of them worked

bindIp: "10.0.1.1,10.0.1.2"
bindIp: [10.0.1.1,10.0.1.2]

Other posts or tutorials suggests one of them, I am not sure why it is not working for me. following is the error I get

mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

can someone help me to get it started with multiple ips

Welcome to the MongoDB Community @Vikram_Singh!

Unless your computer has multiple network interfaces (i.e. 10.0.1.1 and 10.0.1.2 are both local network interfaces on the host for your mongod instance), this configuration will not work. The bind IP directive determines which local network interfaces a mongod process will listen to.

If you review the MongoDB log file you will likely find a message like:

Failed to set up listener: SocketException: Can’t assign requested address

For more information, please see my post on I can't set bindIp - #2 by Stennie_X.

Regards,
Stennie

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.