Friday, December 11, 2009

dnsmasq for local virtual network

Setting up local virtual network with VirtualBox. The setup:-

Main Host
  • eth0/bridged mode listen on 192.168.1.200. Connected to the real local LAN.
  • eth1 listen on 10.0.0.1 - dnsmasq dhcp listen here.
Sub internal host
  • app2 - eth0/internal network 10.0.0.2
  • db - eth0/internal network 10.0.0.3
/etc/dnsmasq.conf setup so that the dhcp assigned the IP address from /etc/hosts for any matching hostname.

dhcp-host=app2,db

But the client still getting the lease in dhcp-range rather than the one set in /etc/hosts. Turn out we need to set "send host-name app2;" in /etc/dhcp3/dhclient.conf because dhclient does not send the hostname by default when acquiring the lease.

No comments: