0

I’m running VirtualBox on Windows 7, the guest virtual machine OS is Ubuntu Server and it’s set up in such a way that I can access it from the host machine on 192.168.56.101.

The host machine IP in the local network is 192.168.16.100.

What I want is for the Ubuntu Server's server (Apache and stuff) to be able to be accessed from other computers in the network as well. Some of them run Mac OS, some Android. The IP for the one that runs Mac OS is 192.168.16.102.

Is this possible?

2 Answers 2

0

You say the host IP addresses are like this:

  • Host OS (Windows 7): 192.168.16.100
  • Guest OS (Ubuntu): 192.168.56.101
  • Mac OS: 192.168.16.102

If your guest OS is set to the 192.168.56.x subnet that would be a host-only adapter in Virtual Box. Which is a great setup, but not so great for what you are trying to achieve. This simplest thing you could try to do is change that adapter from host-only mode to bridged mode.

When in bridged mode, the guest OS would be reaching out to your network’s router so it would be on the 192.168.16.x subnet or whatever subnet your larger LAN is a part of. How to assign an address would be up to you, but if your router does DHCP you could assign a reserved IP address (static via DHCP based on MAC address) to this guest OS machine. Or—of possible—just see if you can safely assign a static IP address without too much hassle to the guest OS.

That said, if I were you I would prefer to do the following: leave the host-only adapter as-is but create a new, third network adapter in VirtualBox that would be the bridged adapter. That way your guest OS retains the host-only adapter connection on 192.168.56.101, but you then gain an additional bridged adapter that is a part of the 192.168.56.x subnet. That way to get the best of both worlds.

2
  • I spent a lot of time setting up the network in vm to be able to access apache in the host and I remember that it was in bridged mode initially and I had problems when changing IPs in the host. Every time my host IP changed I had to reconfigure the vm :( But I'll try add to add it as 3rd adapter and see if that helps, thanks
    – elfy
    Mar 2, 2015 at 19:25
  • ok that seems to work :)
    – elfy
    Mar 2, 2015 at 19:58
1

The easiest way is to set the network adapter to be bridged - This means that the VM will connect directly to the host computer's subnet, in the 192.168.16.x range. From there, make sure you can ping it by name to complete the setup.

For accessing it outside your network, you can now setup port forwarding - although that's out of the scope of this particular question.

You must log in to answer this question.

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