0

I have a mongod service running on port 27017 on the guest machine

I also have port forwarding enabled to forward host 27017 to guest 27017

Yet, when I try to connect to my mongodb with Robo3T i would get Network is unreachable. Reason: network error while attempting to run command 'isMaster' on host '127.0.0.1:27017'

I am running ubuntu 18.04 and mongodb4.2

Interestingly, the same setup with Ubuntu 14.04 and mongodb 3.2 would work without issues.

(The environments were configured with boxes on vagrant, so trusty64 with mongodb 3.2 would work, but bionic64 with mongodb4.2 doesn't)

Zhen Liu
  • 7,550
  • 14
  • 53
  • 96
  • It pains me somewhat that there is an answer on StackOverflow ( even though it is currently heavily nominated for deletion ) since the general question really is something more suited to https://superuser.com. Nonetheless it's currently there, so I'll use it. If you're the type who prefers screenshot images to follow rather than a textual explanation, then https://www.google.com/search?q=virtualbox+port+forwarding&oq=virtualbox+port+forwarding will show you results. Vagrant uses Virtual Box, and the "software configuration" or even "neworking" question has answers elsewhere. – Neil Lunn Nov 03 '19 at 09:51
  • I can get it to work easily with ubuntu 14.04 and mongodb 3.2. But 18.04 and mongodb 4.2 don't work. I don't think people have addressed the newer versions yet. – Zhen Liu Nov 04 '19 at 19:42
  • I think they have. I have latest ubuntu releases and latest MongoDB running under the same processes described. This has nothing to do with versions of ubuntu or MongoDB. You simply have not set up the port forwarding on the Virtual Box settings properly. And I really do hope you realize at least at some point that you cannot "port forward" from multiple running virtual machines to the same port. But again I will stress, **this is not a programming question**. If you really think you have something more to discuss, then please go and ask your questions on the other sites you were shown. – Neil Lunn Nov 05 '19 at 09:17
  • I wish it were that simple with port forwarding. But sure I can move my question elsewhere – Zhen Liu Nov 05 '19 at 19:31

0 Answers0