[Dnsmasq-discuss] Can't make dnsmasq work on a VirtualBox host-only network

Mike Williams mdub at dogbiscuit.org
Fri Oct 1 02:13:01 BST 2010


Hi,

I'm attempting to set up a virtualized "farm" of servers under
VirtualBox. I'll need to create a bunch of VMs, and I don't want to
have to manually set their hostname and IP address, so a DHCP solution
is attractive. The DHCP server built into VirtualBox doesn't allow us
to either (a) dynamically update the DNS, or (b) pre-bind MAC
addresses to IP addresses, so I've been looking at using dnsmasq. 

I'm running dnsmasq on the (Mac OS X 10.6) host, with the following
config:

  interface=vboxnet0
  bind-interfaces
  dhcp-range=vboxnet0,192.168.56.100,192.168.56.200,255.255.255.0,1h
  dhcp-leasefile=/usr/local/etc/dnsmasq.leases

vboxnet0 is the "host-only" network adapter set up by VirtualBox to
allow communication between the host and guest.  

The guest VMs (Debian lenny) are set up with host-only network
adapters, and the following in their /etc/network/interfaces:

  auto lo eth0
  iface lo inet loopback
  iface eth0 inet dhcp

With this setup, I can happily send TCP traffic in both directions 
(between host and guest VMs).

I can't quite get dnsmasq working, though!

Running (dnsmasq) in debug mode, when I run "dhclient" on the 
guest VM I can see the DHCPDISCOVER packet come in, and the 
DHCPOFFER go back out:

  dnsmasq: started, version 2.55 cachesize 150
  dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-I18N DHCP TFTP
  dnsmasq-dhcp: DHCP, IP range 192.168.56.100 -- 192.168.56.200, lease time 1h
  dnsmasq: reading /etc/resolv.conf
  dnsmasq: using nameserver 10.112.121.75#53
  dnsmasq: using nameserver 10.112.121.55#53
  dnsmasq: read /etc/hosts - 10 addresses
  dnsmasq-dhcp: DHCPDISCOVER(vboxnet0) 192.168.56.103 08:00:27:7c:fc:c5
  dnsmasq-dhcp: DHCPOFFER(vboxnet0) 192.168.56.103 08:00:27:7c:fc:c5
  dnsmasq-dhcp: DHCPDISCOVER(vboxnet0) 192.168.56.103 08:00:27:7c:fc:c5
  dnsmasq-dhcp: DHCPOFFER(vboxnet0) 192.168.56.103 08:00:27:7c:fc:c5
  ...

Unfortunately, the guest never sees the DHCPOFFERs, and eventually
gives up in disgust. It seems like the DHCPOFFER packets aren't making
it back onto the host-only network (vboxnet0).

Help! Any ideas how I might get dnsmasq working effectively? Is this
more likely to be a problem with dnsmasq, or with VirtualBox's
networking?  How might I debug it further?

-- 
cheers, 
Mike Williams




More information about the Dnsmasq-discuss mailing list