[CentOS] Home LAN server - dnsmasq

M. Milanuk memilanuk at gmail.com
Sun Dec 13 04:17:00 UTC 2009


Hello all,

I'm testing a home LAN server inside Virtualbox - figured it'd be easier 
to build (and fix) things inside a virtual sandbox first, and then 
migrate over to a physical install once I have most of the kinks worked 
out.  The host OS is Windows Vista; the guest OS will be various Linux 
distributions for education/entertainment purposes.

First, a little explanation on the 'lay of the land':

The first virtual machine is a gateway/router box running CentOS 5.4. 
The 'outward' facing NIC is eth0, and it picks up an IP through the NAT 
interface provided by Virtualbox.  That part seems to be working fine at 
the moment.  The VM has CentOS 5.4 installed, downloaded and installed 
updates, and can browse the web, etc.  The 'internal' network adapter 
(eth1) is connected to a virtual LAN 'intnet' that is otherwise not 
accessible from the 'outside' world at this point.  It has a static IP 
assigned (10.0.0.1/255.255.255.0), and dnsmasq is running.

Here is the contents of /etc/dnsmasq.conf:

domain-needed
bogus-priv
filterwin2k
except-interface=eth0
dhcp-range=10.0.0.50,10.0.0.100,1h
dhcp-host=asmodean
dhcp-host=demandred
dhcp-host=lanfear
dhcp-authoritative
conf-dir=/etc/dnsmasq.d

and here is the contents of /etc/hosts:

127.0.0.1	localhost.localdomain	localhost
::1		localhost6.localdomain6	localhost6

10.0.0.1	rahvin.local		rahvin
10.0.0.2	asmodean.local		asmodean
10.0.0.3	demandred.local		demandred
10.0.0.4	lanfear.local		lanfear

What I *want* to happen is to be able to give a fixed dhcp lease to a 
client that sends a particular name from /etc/hosts - that way I just 
have to maintain /etc/hosts on the gateway/router box for local DNS, and 
I don't have to fiddle around finding and recording and entering the MAC 
addresses for each network card on each machine (actually easier on a 
'virtual' lan than in real life, but still a minor PITA).  I got the 
idea from this clause in the original dnsmasq.conf file:

# Enable the address given for "judge" in /etc/hosts
# to be given to a machine presenting the name "judge" when
# it asks for a DHCP lease.
#dhcp-host=judge

The specific problem I'm having is that of the virtual 'clients', only 
one of them is getting assigned an IP address from the list in 
/etc/hosts.  'asmodean', running Ubuntu 9.10 gets its IP address of 
10.0.0.2 as planned.  The other two, demandred (running F12+LXDE) and 
lanfear (running Debian 5.03 Lenny), get randomly assinged IP addresses 
from the pool defined in dnsmasq.conf (10.0.0.50-10.0.0.100) like one 
would normally expect for a *dynamically* assigned lease.  Except I 
wanted them to get fixed leases based on /etc/hosts.

I've looked at most everything I can think of on both hosts... it 
doesn't seem to much matter if I set the hostname to 'demandred.local' 
or just 'demandred'.  I'm not sure how to tell if the clients are 
sending that information in their requests?

Any other ideas or suggestions?  I realize the problem may not be 
strictly with the CentOS box, but any help would be greatly appreciated.

TIA,

Monte



More information about the CentOS mailing list