Admittedly, it’s been a long, long time since I’ve had to do a fresh install of mongodb…I am in the process of setting up a couple of mongo servers behind my firewall to use for cluster testings. Ancient PC’s. AMD Athalon class. One even has a floppy disk installed.
Anyway, once I had the OS installed (Ubuntu 12.10 server) and all the various packages, including mongodb, added to the system, I wanted to access the mongodb from another machine on my network but for the life of me I couldn’t connect to the default port of 28017.
Oh, I could connect from localhost using wget without problem.
netstat -a | grep -i listen
Showed port *:28017 in listen mode so no problem there…
I even added the port via iptables to the firewall rules:
iptables -A INPUT -p tcp -d 0/0 -s 0/0 –dport 28017 -j ACCEPT
But I still couldn’t connect.
I started to browse /etc/mongodb.conf file looking for a configuration setting that may prevent me from accessing remotely and there is was:
bind-ip = 127.0.0.1
Since I don’t have concerns about security on my private network, I commented out this line and restarted mongo services.
(side note: you don’t want to do this on a production server – instead, use a comma-separated list of ip-addresses to specifically authorize which remote hosts you will permit to connect to your mongo server.)
Worked! Full access from within my network to mongod!
Hope this helps!