Networking suggestions

This is for discussing general topics about how to use VirtualBox.
Post Reply
xalorous
Posts: 5
Joined: 11. Apr 2011, 22:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows, Linux

Networking suggestions

Post by xalorous »

Home network is through a wireless router with hosts on private network IP's assigned by router. VBox host is one of those. Right now I have the guests on static IP's in a different (private) subnet, outside the wireless router's DHCP subnet.
example: host 192.168.1.2, guests 192.168.2.x, both networks with SNM 255.255.255.0.

I want my 'lab' network to be isolated, but with access to each other and the host. I want my guests to only see the host (and each other), and I want to be able to run headless, with RDP from the host to the guests.

What I want:
1. RDP from my Host to the guests. The VBox gui has one glaring problem, it is a local login, and while I can log off, I can't close the window once I open it without shutdown/poweroff the guest. What I see as my solution is "Host-Only Networking". Guest to guest, this is no problem, but I'm having problems connecting Host to Guest (like RDP or ping). I suspect this is because the host doesn't have a route to the guests' subnet. If the above is my network setup, would I simply need to expand the subnet to double width? 255.255.254.0? If I do this, will other hosts on my network see my vm guests if I'm using "Host-Only Networking"?

2. Connect my private network through [some method] in a way that I can turn it on only when I need it (updates etc) but leave it off when I don't need internet connectivity to the guest. Looks like any time I need it I can switch the network connection to NAT or Bridged and that guest will then have access to the outside world. I should probably build both connections and disconnect one when I connect the other.

*extensions allowing VRDP are installed on host.
*guests are configured to allow RDP access.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Networking suggestions

Post by Sasquatch »

If you have your guests configured to use 192.168.2.x, then with the defaults for Host-Only, it only makes sense the Host is unable to access the Guests. The other way around has the same problem. This is because the Host-Only interface is set to use 192.168.56.1 on the Host side. If you have the DHCP enabled (forgot if it's default, thought you have to enable it specifically), then the Guests will obtain an IP from the Host (or actually, from VB) in the range you specified. Defaults to 192.168.56.100 to .200.

So either you adjust the Guests to use the 56.x range, or you change the Host-Only IP address from File > Preferences > Network to the 2.x range. Make sure it doesn't conflict with existing interfaces on the Host.

This is noted in the User Manual though (the IP range set by default).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Networking suggestions

Post by BillG »

You have two networks using two different subnets. The only machine which needs to be in both subnets is the VirtualBox host. You could use the host only network, but since the host is Windows you could install a Microsoft Loopback Adapter in the host and link your virtual network to that (and disable the host only adapter in the host). Then give the MLA an IP in the 192.168.2 subnet.

http://www.groovypost.com/howto/microso ... windows-7/
Bill
xalorous
Posts: 5
Joined: 11. Apr 2011, 22:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows, Linux

Re: Networking suggestions

Post by xalorous »

Problem is that I did not see the DHCP part of the Virtualbox network settings in the manual... I found the Vbox DHCP server. Since that's something I was setting up internally to my lab network, I turned it off. FYI - it kept working until the Host restarted.

Once I realized that the guests can only see the host, even if they are on the same subnet (traffic not routed through the host in Host-Only mode), I decided to use a half a class C for the hosts and half for my guests. So, hosts and guests are on same subnet but vbox doesn't route between them. Host-Only adapter (staticly configured) on the host allows the host (only) to communicate with my guests.

192.168.2.2-126 - range allowed by host network router/dhcp service, vbox host falls in this range, all hosts get /24 subnet mask.
192.168.2.128-254 - range for guest network DHCP server, with a few reserved for guest servers

I can successfully ping guests from host and RDP into the server. Was having trouble with a windows guest, then I learned that home versions cannot accept RDP in. So I popped in a disk and made a XP Pro guest and I'm up and running.

I can also see that I can leave the vbox host-only adapter alone on 192.168.56.1, turn off the vbox dhcp, and use the guest DHCP server in the same range and get the same effect without redoing my router settings.
Post Reply