1

I have a OSX host machine named A. It has a guest vagrant/virtualbox VM running ubuntu with apache web server. I can access the server page from the host by going to 192.168.44.44. I want to be able to access the same page from another machine, B, that is on the same local network. So far I can only ssh between From A into B and vice versa. Do I need to configure the router to forward anything? If so what exactly I need to forward? I tried doing the forwarding in the router as you see below but when I hit save, I get an invalid ip message: enter image description here

And here are my virtualbox network configs:

enter image description hereenter image description here

2 Answers 2

1

On the preferences window of your virtualbox (not the virtual machine) go to network and open the properties of your natnetwork.

There locate the port forwarding button (clic on it)

In the resulting window add your rule, the name is not relevant.

First your computer IP and port, then the IP of your virtual machine attached to your NATNETWORK and the port.

In my case used 192.168.1.102:8069 for the host and 10.0.2.7:8069 for the guest.

So now I can access my server from any computer on my LAN.

I hope this is useful for you.

Best regards,

0

As long as machine B is in the same network segment as your OSX Host then the router doesn't need to do anything clever.

You have a few options:

  • Enable network bridging mode and have the guest machine get it's own IP address via dhcp

OR

  • Enable the port forwarding in VirtualBox for the ports the server on the guest is using (it sounds like you've already done this as you can access the web page), making sure to allow all the lan addresses to connect.

If you use the second option, you'll want to make sure you also allow the ports through on the firewall, again from anywhere on the local lan.

5
  • 1
    Great thanks, I will try this tonight and report back, but sounds like exactly what I need. Also, if I choose the port forwarding option, what exactly I need to forward?
    – Ali
    Commented Jan 4, 2017 at 16:04
  • You'll need to forward the ports in use - for web this is port 80 for http and 443 for https normally (but in reality you can use any port). Commented Jan 4, 2017 at 16:50
  • I tried option 1, and I could not connect to the VM. I tried option 2, (which I want to stick with) and it did not do it for me. I presume it has to do with my vbox vm network settings. I uploaded more pics in the question to show it. I suspect it most likely the "host-only adaptor" thingy.
    – Ali
    Commented Jan 5, 2017 at 3:28
  • Ok on the NAT settings you have a port forwarding box, this is the one you need to add the ports to. Commented Jan 5, 2017 at 11:54
  • The only way I got it to work is to have my vagrantfile set a public network config.vm.network "public_network", ip: "192.168.0.17 this way, the box gets another adapter, attached to Bridged Adapter and name en0: wifi (airport). And now on any local machine I go to 192.168.0.17 and see the webpage. I am thinking there is something in my set up that preventing me from using the port forward way. if you still think it is still option, can u pls inculde details? what should I put for, host ip, host port, guest ip and guest port?
    – Ali
    Commented Jan 5, 2017 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .