title: How to set mongod.conf bind_ip with multiple ip address
body: <p>I am a newbie for setting up the server environment and mongoDB. This may sounds something really simple, however, I really need your help on it.</p>
  
  <p>I am trying to connect to my virtual machine which runs the mongodb instance from the local machine, which I believe should be similar to the production environment when I run it on a separate remote server.</p>
  
  <p>The environment is as following:</p>
  
  <ul>
  <li><p>Private IP for virtual machine: <em>192.168.184.155</em></p></li>
  <li><p>Public IP for both local machine and virtual machine: <em>96.88.169.145</em></p></li>
  </ul>
  
  <p><br></p>
  
  <p>I changed the <strong>bind_ip</strong> in <strong>/etc/mongod.conf file</strong> from</p>
  
  <pre><code>bind_ip = 127.0.0.1
  </code></pre>
  
  <p>to</p>
  
  <pre><code>bind_ip = 127.0.0.1,192.168.184.155,96.88.169.145
  </code></pre>
  
  <p>After I restarted the mongod service, neither the virtual machine nor the local machine can access mongodb through mongodb command and giving me the following error.</p>
  
  <pre><code>MongoDB shell version: 3.0.1
  connecting to: test
  2015-03-17T16:02:22.705-0400 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
  2015-03-17T16:02:22.707-0400 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
      at connect (src/mongo/shell/mongo.js:179:14)
      at (connect):1:6 at src/mongo/shell/mongo.js:179
  exception: connect failed
  </code></pre>
  
  <p>However, if I change the </p>
  
  <pre><code>bind_ip = 192.168.184.155
  </code></pre>
  
  <p>and restart the service, it works and I can access using mongo from my local machine. It seems just not work with multiple ip addresses. I tried to do look up in the mongodb document, however, they does mention that bind_ip takes a comma separated list, which really confused me.</p>
  
  <p>Thanks for your help in advance.</p>