Multiple bindIp is not working

600 views
Skip to first unread message

Gaurav Lankepillewar

unread,
Aug 7, 2018, 6:19:18 PM8/7/18
to mongodb-user
Hi Team,

I have installed MongoDB shell version: 3.2.16 on CentOS release 6.6 (Final). I have been trying to impose security where in only localhost and some specific address can connect to MongoDB. 
I have configured this in /etc/mongod.conf file like below...

# network interfaces
net:
 # bindIp: 0.0.0.0
  port: 27017
  bindIp: 127.0.0.1 192.168.2.12  # Listen to local interface only, comment to listen on all interfaces.

In this case, it should allow only these two IP's to get into database. But it is accepting only localhost connections and not from 192.168.2.12.

How can we achieve this, should allow these two and not any other IP's

Please assist in this regard.

Thanks...!




Oleg Toropov

unread,
Aug 7, 2018, 11:22:47 PM8/7/18
to mongod...@googlegroups.com
from the docs: "To bind to multiple addresses, enter a list of comma-separated values"

bindIp: 127.0.0.1,192.168.2.12 should work

 

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1a2dafe6-6e0b-48a9-9a9b-ba217da0201a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
//
// Oleg V.Toropov, MCP | oleg.t...@gmail.com
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//

lian....@mongodb.com

unread,
Aug 19, 2018, 11:20:42 PM8/19/18
to mongodb-user

Hi Gaurav,

The bindIP configuration value only determines which IP addresses your MongoDB server is listening to for connections from applications. It does not control access from remote IP addresses (this is the role of the firewall). You will need to configure the firewall to allow communication between the MongoDB server and client applications.


Unless the MongoDB server has an IP address of 192.168.2.12 as an interface, the bindIP setting will have no result. When attaching mongod (or mongos) to a publicly accessible interface, ensure that you have implemented proper authentication and firewall restrictions to protect the integrity of your database.


To secure your MongoDB environment, it is recommended to review the MongoDB Security Checklist for a full list of security measures.


Regards,

Lian

Reply all
Reply to author
Forward
0 new messages