Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I'm trying to do is create a host-only network with multiple VMs so as to allow direct access between the host OS and the VMs, but to also allow the VMs limited access to the Internet for things like software updates, NTP, etc.

FWIW, I can do this using an internal network ('intnet'). I have successfully set up a couple server appliance VMs (TurnKey Linux), a desktop OS VM (Debian), and a gateway/firewall VM (Smoothwall Express) that is dual-homed (one NIC on the internal network, and the other connected via NAT to the outside world). I set up the gateway machine as a DHCP server, the other VMs get their connection info from it, the server appliance VMs can connect for updates, and I can browse from the desktop OS VM to the Webmin control panels on the server appliances. Everything works as intended.

When I try doing the same thing on a host-only network so I can connect directly from the host OS (Ubuntu 11.10 Desktop) to the guest VMs... all sorts of weirdness ensues. Basically... it seems as though the host-only built-in DHCP server is over-riding any attempts to use any other DHCP server (like the one on the gateway/firewall VM), even when I turn it OFF in VirtualBox - even when I turn off the built-in DHCP server, turn off the program, restart it, and re-boot the guest VMs - they still either pick up their IP info from the built-in DHCP server (it doesn't change, despite the 'new' DHCP server using a different block of addresses), or aren't able to connect at all (can't get a DHCP lease).

I'm starting to wonder if I'm trying to do something that Virtualbox host-only networking just isn't capable of... Can anyone replicate this problem or point out what I'm doing wrong?

share|improve this question
    
Can someone try this scenario and see what they get? Is it just me or is it something with Virtualbox? –  memilanuk Feb 3 '12 at 21:22
add comment

2 Answers

up vote 0 down vote accepted

I think you are on the right path, it shouldn't matter too much which network you choose for the private segment - either then host-only or a separate internal network. Granted, the internal network will guarantee separation from the host as you describe.

One thing to watch out for - when configuring the smoothwall (assuming a simple RED/GREEN setup), did you give the GREEN interface a different IP address from the one assigned to your host? The host probably has 192.168.56.1 assigned, but it can vary.

Also, I can understand wanting to use the smoothwall DHCP server the private clients, but if it is causing you grief can you not just use the built-in VirtualBox DHCP server for the host-only network? I would imagine you would want to disable this (it sounds like you might have but it wasn't clear) if you were planning on using a different DHCP server on that interface.

Regarding the problem of DHCP going haywire, you don't have any weird bridged adapters or something else configured on the host do you?

For reference, you can see the registered and active servers by issuing the following command on the host:

VBoxManage list dhcpservers

Here is the output from that command for me:

NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP:             192.168.56.100
NetworkMask:    255.255.255.0
lowerIPAddress: 192.168.56.101
upperIPAddress: 192.168.56.254
Enabled:        No

You can then enable or disable the DHCP server on that network with the following commands:

VBoxManage dhcpserver modify --netname "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter" --enable
VBoxManage dhcpserver modify --netname "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter" --disable
share|improve this answer
    
I had turned off the built-in DHCP server for the host-only network via the GUI interface of Virtualbox. The idea was to be able to manage all the networking stuff from the Smoothwall gateway - dhcp, ntp, dns, etc. instead of using the built-in dhcp server and manually have to tell the clients where to look for the other stuff. I was careful with the Smoothwall interface names, as it's tripped me up in the past. Running ifconfig on the smoothwall vm shows one nic on 10.0.x.x (Vbox NAT) and the other on the host-only network (192.168.56.xxx). –  memilanuk Jan 30 '12 at 20:16
    
Well, work got busy so my 'hobby' time went to zero for a couple days. Anywho, I went ahead and fired back up the VMs with the built-in Vbox DHCP server - they got their addresses like they should. Turned off the Vbox DHCP server, and verified that it was 'off' using the command line 'VboxManage list dhcpservers' as suggested above... and still when I fired up the Smoothwall firewall/gateway VM, verified its DHCP server should be running (and supplying a different range than the built-in one), when I forced the clients to renew their DHCP lease, they somehow got the original one again. –  memilanuk Feb 3 '12 at 3:14
add comment

This tutorial shows one way to connect a host only network to the Internet: http://www.tbogard.com/2011/04/21/virtualbox-give-internet-to-a-host-only-virtual-machine-with-iptables/

share|improve this answer
    
If I'm understanding that correctly... they're essentially making the host OS dual-homed with the host-only interface on one side, and the outside world on the other, and having the host OS itself be the firewall? –  memilanuk Jan 30 '12 at 20:20
    
That's my understanding too. The main difference with your setup is the host is the gateway instead of a dedicated guest. –  jlliagre Jan 30 '12 at 20:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.