I have the following config file:

  port: 27017

  dbPath: c:\mongoDATA\db
    enabled: true

 ## destination: file
 ## path: C:\mongoDATA\log\mongodb.log   
 ## logAppend: true

this works, but when I try to add multiple ports like:

bindIp: ","
bindIp: [,]

with or without the space after the comma it doesn't. Could someone provide the write syntax? Thanks (using 3.6 community)

3 Answers 3


without a space after the comma, AND the ip address has to present

  • "ip has to present" where the ip has to present?? @DCR Sep 17, 2020 at 16:17

@DCR, Wrap the comma-separated-Ips with brackets.

For example suppose that we have multiple ips like (, and loop back ip( then the binding syntax will be as mention below

bindIp = [,,]

For further your ref Fix bindIp multiple address notation in Configuration Options, Here,Here and How to set mongod.conf bind_ip with multiple ip address


For 4.4.6, so - lets assume for series 4.x (perhaps for some of series 3.x)

The correct syntax is:

  • bindIp:,<private_host_ip>,<public_host_ip>

For each new IP just use , and without any spaces

For LAN access must be used the private_host_ip, you can use ipconfig or ip a for Windows and Linux respectively to know the ip value. Of course for public WAN access must be used <public_host_ip>, it about your ISP

Warning both ips - private_host_ip and <public_host_ip> - are the locations where your MongoDB server is running, not the remote clients. Therefore exists the wrong assumption to add each new ip where each one represents the remote client IP address (other different than the server IP address - LAN and/or WAN), it is not correct.

Note To avoid problems is better for both use static ips, the private through your router and the second through your ISP.

Your Answer

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

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