Page 1 of 1
Accessing guest when host is on different network
Posted: 25. Jan 2013, 20:01
by ramiwi
I`m running VirtualBox 4 on Windows 7 with a guest Ubuntu server 12 vm.
The host computer ip is 10.0.0.1 and the guest ubuntu is configured as 192.168.21.129 (i dont want to change these ip addresses).
How should i configure this setup so i can access the guest webserver from the host and from other computers on the lan?
Thanks
Re: Accessing guest when host is on different network
Posted: 25. Jan 2013, 20:28
by Perryg
Since the guest is not in the same subnet as the host you would need to have a router.
Re: Accessing guest when host is on different network
Posted: 25. Jan 2013, 20:31
by noteirak
Just to clarify on Perryg's thoughts, the router can be a VM, or the host, or a separate hardware - that is up to you.
Re: Accessing guest when host is on different network
Posted: 25. Jan 2013, 21:30
by ramiwi
Thanks,
Which option is the easiest to configure? and how should i do it?
Re: Accessing guest when host is on different network
Posted: 26. Jan 2013, 01:28
by BillG
Why do you not want to change the IP of the guest? It makes no sense for it to have a 192.168 address if all of the machines it needs to communicate with are in 10.0.0. Going to the trouble of installing a router and changing default gateways and/or installing static routes just to make this work for one machine would need a compelling reason (especially if you don't know how to do it).
If you do have some compelling reason, post a bit more information about how you network is configured.
Re: Accessing guest when host is on different network
Posted: 26. Jan 2013, 02:51
by ramiwi
I wanted this IP fixed because its used in several site configurations on this development server (the vm). The host pc is sometimes connecting to the internet through different router/modems so i thought it would be easier for me to this way, but its wont be the case if i will be adding special routes for other pcs, so eventually I just changed my current router subnet to match the vm`s ip.
Re: Accessing guest when host is on different network
Posted: 26. Jan 2013, 08:50
by noteirak
ramiwi wrote:Which option is the easiest to configure? and how should i do it?
Since you have a Windows host, I would go for a VM router - either pfSense or a minimum-install debian.
Virtualbox config will be as follow :
On your new router VM, 2 NICS :
1 bridged on your 10.0.0.x LAN, give it a static IP (let's say 10.0.0.253)
1 Internal under the name (purely arbitrary) "devLan"
Enable IP Routing in the VM (if not already)
On your Dev VM
1 Internal under the name "devLan" (the same as your router VM)
On your network (your actual hardware router) : route the 192.168.x.x network towards your router VM bridged IP (10.0.0.253 in this case)
Re: Accessing guest when host is on different network
Posted: 26. Jan 2013, 20:12
by jorgensen
I can recommend reading a book about Ethernet networking and routing.
From your post, I am not sure if you are using NAT or Bridged Networking for the guest.
If using Bridget Networking, Virtualbox uses the standard rules for IP routing, where the setting of gateway is essential.
You can do a lot of routing in the Window 7 host - try the command 'route print' to get an idea.
Usually you can reach the host from guest by using the IP address.