Fix host-only adapter Virtualbox can’t dhclient and get ip address

I use Ubuntu 11.10 as Host and Ubuntu 11.04 as Guest on Virtualbox 4.1.4. I running VM using Vagrant and Virtualbox (for Desktop version). When i set host-only adapter, i got issue that my network card (eth1) can’t get IP address.

This is weird which i have this work before. Switch on-off on network card doesn’t fix this problem. Also, when i delete “/etc/udev/rules.d/70-persistent-net.rules”, the problem still occured.

After diving for a while, i gota the solution.

1. Configure Host-adapter
Go to File -> Preferences -> Network. If you don’t have vboxnet0, you should create new one. Then, we need to configure this host-only adapter to available for static and dhcp ip. Edit this adapter :
For example, i use 33.33.33.1 as my host IP address.

On Adapter tab :

IPv4 address = 33.33.33.1
IPv4 Network Mask = 255.255.255.0
IPv6 Address = ...
IPv6 Network mask length = 64

On DHCP Server tab :
Check “Enable Server” and configure :

Server Address = 33.33.33.1
Server Mask = 255.255.255.0
Lower Address Bound = 33.33.33.10
Upper Address Bound = 33.33.33.100

2. Edit network interfaces Guest / VM
Edit /etc/network/interfaces :


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp

# The primary network interface
auto eth1
#iface eth1 inet dhcp

3. Reset Network Card
by deleting “/etc/udev/rules.d/70-persistent-net.rules” :

sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules

Reboot your VM and you should have host-only network adapter have IP address on range 33.33.33.10 – 33.33.33.100.

One thought on “Fix host-only adapter Virtualbox can’t dhclient and get ip address

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>