Currently I am having trouble remote connecting a mongodb server on my virtual Ubuntu machine. I am unable to connect to with with Robomongo client that is running on my Windows PC that is also running the vm.
Here are the IP Addressees for both pcs
Windows:
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.1.137
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Ubuntu:
enp0s3 Link encap:Ethernet HWaddr 08:00:27:6c:fc:9c
inet addr:192.168.1.134 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::9785:55d7:130:6618/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5021 errors:0 dropped:0 overruns:0 frame:0
TX packets:465 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1231057 (1.2 MB) TX bytes:45237 (45.2 KB)
The error that I am getting on windows that show it can't connect:
Netstat that shows mongo is running:
netstat -tulpn | grep 27017
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 3611/mongod
From this point I tried to connect locally to the server and it works:
mongo --port 27017
MongoDB shell version: 2.6.10
connecting to: 127.0.0.1:27017/test
Then I tried to add port 27017 to the ufw and still unable to connect:
sudo ufw status
To Action From
-- ------ ----
27017 ALLOW Anywhere
27017 (v6) ALLOW Anywhere (v6)
Thanks for the help in advance.
Found the problem. It was due to the bind_ip flag in my mongodb.conf being set to 127.0.0.1. This is why I as only able to connect locally to the mongodb server.
Resolution was to comment out the bind_ip flag so it would not white list the IP Addresses.
Mongodb.conf