title: Mongo can't connect to remote instance
body: <p>I installed mongodb on remote server via vagrant. I can access postgres from my local system but mongo is not available. When I login via ssh and check mongo status it says that mongo running, I can make queries too. When I try to connect from my local system using this command:</p>
  
  <pre><code>mongo 192.168.192.168:27017
  </code></pre>
  
  <p>I get an error</p>
  
  <pre><code>MongoDB shell version: 2.6.5
  connecting to: 192.168.192.168:27017/test
  2014-12-27T22:19:19.417+0100 warning: Failed to connect to 192.168.192.168:27017, reason: errno:111 Connection refused
  2014-12-27T22:19:19.418+0100 Error: couldn't connect to server 192.168.192.168:27017 (192.168.192.168), connection attempt failed at src/mongo/shell/mongo.js:148
  exception: connect failed
  </code></pre>
  
  <p>looks like mongo not listen to connection from other ips? I commented bind_ip in mongo settings but it doesn't help.</p>
  
  <p>services for 192.168.192.168 via nmap command:</p>
  
  <pre><code>PORT     STATE SERVICE
  22/tcp   open  ssh
  80/tcp   open  http
  111/tcp  open  rpcbind
  5432/tcp open  postgresql
  9000/tcp open  cslistener
  </code></pre>
  
  <p>Looks like mongd listen</p>
  
  <pre><code>sudo lsof -iTCP -sTCP:LISTEN | grep mongo
  mongod    1988     mongodb    6u  IPv4   5407      0t0  TCP *:27017 (LISTEN)
  mongod    1988     mongodb    8u  IPv4   5411      0t0  TCP *:28017 (LISTEN)
  </code></pre>
  
  <p>Firewall rules</p>
  
  <pre><code>sudo iptables -L -n
  Chain INPUT (policy ACCEPT)
  target     prot opt source               destination         
  
  Chain FORWARD (policy ACCEPT)
  target     prot opt source               destination         
  
  Chain OUTPUT (policy ACCEPT)
  target     prot opt source               destination   
  </code></pre>
  
  <p><strong>Update</strong>
  My mongo config</p>
  
  <pre><code>dbpath=/var/lib/mongodb
  
  #where to log
  logpath=/var/log/mongodb/mongodb.log
  
  logappend=true
  
  #bind_ip = 127.0.0.1
  #port = 27017
  
  # Enable journaling, http://www.mongodb.org/display/DOCS/Journaling
  journal=true
  
  # Enables periodic logging of CPU utilization and I/O wait
  #cpu = true
  
  # Turn on/off security.  Off is currently the default
  #noauth = true
  #auth = true
  </code></pre>