Host-only network with multiple VMs

This is for discussing general topics about how to use VirtualBox.
Post Reply
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Host-only network with multiple VMs

Post by memilanuk »

So... if I set up a lone VM on a host-only network, I can access it from the host okay.

If I set up an internal network, all the VMs on it can reach each other okay - but I can't directly access the VMs from the host OS i.e. if one of the VMs is a LAMP server, I can't browse directly to it from Firefox on the host.

What I *thought* I would do is set up a host-only network, with multiple VMs installed on it. One as a gateway box to let all the other VMs in the 'sandbox' access the Internet for updates, and then I could still connect 'directly' to the guest VMs via the host-only network. Sounds good... but it doesn't seem to work that way. The first guest VM on the host-only network can be accessed from the host OS, but subsequent VMs seem to end up on a different sub-network no matter what I do as far as network settings.

Am I trying to do something that was never intended, or am I just doing something wrong?

TIA,

Monte
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Host-only network with multiple VMs

Post by mpack »

The host only network should work exactly as you expected it to. If it doesn't work then you messed up the guest config, e.g. by cloning and neglecting to change the MAC address or machine name. If you would like to discuss configuration of a particular guest you should raise the issue in the appropriate guest forum.
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Re: Host-only network with multiple VMs

Post by memilanuk »

mpack wrote:The host only network should work exactly as you expected it to.
Well, thats a relief!
If it doesn't work then you messed up the guest config
Problem is, I'm not doing anything *different* for networking using host-only vs. intnet, other than setting up the host-only network initially and then specifying it during configuration of the VM.
e.g. by cloning
Nope, creating a new VM and installing from an ISO image for each one - in this instance one was a LAMP server, one a LAPP server, another plain PostgreSQL server and the last a Smoothwall router/gateway box.
neglecting to change the MAC address or machine name.
Not cloning, but I will check and see if somehow the MAC address is a problem. I know the machine names are different.
If you would like to discuss configuration of a particular guest you should raise the issue in the appropriate guest forum.
After I double-check the MAC addresses for the virtual NICs, I'll do that.

Thanks,

Monte
memilanuk
Posts: 54
Joined: 1. Jul 2009, 18:16
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: openSuSE, Fedora, Ubuntu, CentOS
Location: Wenatchee, WA USA

Re: Host-only network with multiple VMs

Post by memilanuk »

Okay, I double-checked the MAC addresses... no cloned/duplicated that I could see.

I know I was going to post this in a guest forum, but I'm still kind of confused whether this is a guest problem or a VBox problem...

I installed from scratch five new VMs - all TurnKey Linux machines (LAMP, LAPP, PostgreSQL, MySQL, Fileserver). They all use the host-only network 'vboxnet0', which was configured to provide a DHCP server. They got ip address from 192.168.56.101 to 192.168.56.105. No problems. I could open the web admin pages for each of them via the browser (Firefox) on the host. Everything is looking good so far.

Then we went for #6. A Smoothwall Linux firewall/gateway/router distro. When I set it up to use have the 'red' (external) network card be connected to 'NAT' and configured via DHCP, and the 'green' (internal) card be on a static IP on the same sub-net as the other five VMs... everything worked fine.

Then I disabled the built-in DHCP server on vboxnet0 (the host-only network), and enabled the one on the Smoothwall gateway VM. I 'kicked' a couple of the TKL VMs to renew their DHCP leases... and nothing changed. I'd changed the range leased by the server to 192.168.56.50-192.168.56.60, vs. 100-200 as the default built-in dhcp server had been set for.

I re-installed the Smoothwall server... same thing. Shut it down, installed IP Cop (another firewall distro, with a DHCP server, etc.), with similar results. As long the gateway/server is on the same sub-net as the other VMs, I can ping back and forth between them, and ssh between them. But I cannot get the VMs to get their IP addresses from anything *but* the built-in Virtualbox DHCP server - which is supposed to be disabled?!?

If I go and switch all the VMs over to the internal network 'intnet' and poke 'em to renew their DHCP lease... they all connect to the DHCP server on the gateway/firewall/router distro no problem, and can all access the outside world (Internet) - but I can no longer reach them directly from the host via ssh or browser - like the 'internal' web page controlling the firewall! I can work around this by creating another VM with a desktop OS that I can open up and 'browse' the internal network (I've done this in the past), but it seems like kind of a hack...

What am I missing?
Post Reply