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 VB 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 alternatives.
In particular, I've tried using "dnsmasq", which promises to solve both DNS and DHCP. 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.leasesThe 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 dhcpIt almost works, too ... I'm running dnsmasq in debug mode, so when I run "dhclient" on the guest, 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.99 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.99 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?
Alternatively, can you suggest a better approach to assigning unique hostnames and IP addresses to new (cloned) VMs.