Host only nic needs static IP

This is for discussing general topics about how to use VirtualBox.
Post Reply
Verb
Posts: 15
Joined: 13. Jan 2009, 15:02

Host only nic needs static IP

Post by Verb »

I've created a contained virtual network using host only NICs on a few virtual machines and when the gateway machine gets a different IP through DHCP, it throws off my static routes and other configurations. From reading other threads you're supposed to use DHCP with host only NICs, but I'm hoping there is a work around or if not, someone with better sys admin skills than me knows a way to make this easier.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only nic needs static IP

Post by Perryg »

The default configuration of the VirtualBox host-only adapter is set to its own subnet, and should not be affected by changes in the host. If however your "gateway" is another guest you actually should use the internal networking since it emulates a network switch. In any case we would need to know more about how you have this set up to be able to see where it is breaking down.
Verb
Posts: 15
Joined: 13. Jan 2009, 15:02

Re: Host only nic needs static IP

Post by Verb »

You're right, I have a Linux gateway VM, a windows VM, and a Linux VM running snort that needs to be able to see the traffic between the windows and gateway VM. All VMs have host only NICs, the gateway has two NICs and allows the windows box to communicate with another private network that represents the internet with some virtual IPs that have services running on them.

If I use internal networking on all the VMs, is the snort box still going to be able to see the traffic and is the network going to be just as contained as host-only?

Update: I just tested it and the snort box can see the traffic. The wording of the manual had me a little confused... Anyway... since my VMs are on a different network and no default route to my real network, it seems like it's also just as contained as host-only?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Host only nic needs static IP

Post by Perryg »

The host-only just adds the host to the virtual switch which in most cases is not what you would want. Its design was to be able to use the guest to host communication while no network was available. It can be made to operate like you say but that is outside the scope of this forum. As for the Internal network, yes it works fine as long as you have a gateway machine to perform the routing. Another caveat is the addressing scheme does not change. One last thing, I usually use NAT for the public side since I don't care what the address is and Bridged would confuse the issue as you are see. All you are interested in is getting the public side to the private side and the public address should not come into play.
Post Reply