Assign static IP to a guest in host-only DHCP network?

This is for discussing general topics about how to use VirtualBox.
Post Reply
avamk
Posts: 32
Joined: 7. May 2012, 23:50

Assign static IP to a guest in host-only DHCP network?

Post by avamk »

Hello,

I've setup a couple of guest machines in VirtualBox 4.1.14 in the same host-only network with DHCP. How do I assign static IP addresses to those machines?

Thanks!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Assign static IP to a guest in host-only DHCP network?

Post by Perryg »

Just set them up in the guest. You have to use the same subnet as the host.
avamk
Posts: 32
Joined: 7. May 2012, 23:50

Re: Assign static IP to a guest in host-only DHCP network?

Post by avamk »

Perryg wrote:Just set them up in the guest. You have to use the same subnet as the host.
Hello,

I think I am doing something wrong:

I tried your suggestion with my Scientific Linux 6.2 guest by going to the Gnome Network Connections manager, setting the IPv4 settings to manual, and adding an address like so: IP 192.168.56.101 (the first address available in VirtualBox host-only network settings, netmask 255.255.255.0 (also from the host-only settings). This client seems to connect fine.

However, I started a second guest machine (with dynamically assigned host-only network IP) while the first one is still on, and noticed that it received the same 192.168.56.101 address as the first Scientific Linux guest!

Looks like my VirtualBox host is not aware of the first guest with manually assigned IP?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Assign static IP to a guest in host-only DHCP network?

Post by Perryg »

Well that is probably because you are using the addresses in the DHCP server range (see preferences -> network). Use one that is not in the DHCP rage but the same subnet if you want to assign static addresses.
avamk
Posts: 32
Joined: 7. May 2012, 23:50

Re: Assign static IP to a guest in host-only DHCP network?

Post by avamk »

Perryg wrote:Well that is probably because you are using the addresses in the DHCP server range (see preferences -> network). Use one that is not in the DHCP rage but the same subnet if you want to assign static addresses.
Ah yes, that seems to be the problem. I made the appropriate adjustments and it works well now. Thank you!
Post Reply