[Dnsmasq-discuss] Question

Ron Frederick ronf at timeheart.net
Fri Jan 25 22:56:45 GMT 2008

Simon Kelley wrote:
> Ron Frederick wrote:
>> I prefer a different approach for this. It still relies on ethernet 
>> (MAC) addresses, but it allows me to still use /etc/hosts and doesn't 
>> rely on the client to send its hostname. If you populate /etc/hosts 
>> with a mapping from hostnames to IP addresses and /etc/ethers with a 
>> mapping from those same hostnames to MAC addresses, dnsmasq will 
>> automatically associate the matching MAC addresses and IP addresses. 
>> If you configure a subnet to give out static addresses, it will then 
>> use the mappings it has from /etc/ethers to /etc/hosts to do the 
>> address assignment. For example, here's a snippet of my various config 
>> files:
>> /etc/ethers:
>> 00:11:24:a3:4e:f7 powerbook
>> 00:13:b6:32:32:a7 slingbox
>> 00:0e:08:ca:c4:9b sipura
>> 00:18:f9:03:39:36 vudu
>> 00:08:89:76:7d:e0 dish622
>> 00:1c:b3:68:67:6d iphone
>> /etc/hosts:
>> powerbook
>> slingbox
>> sipura
>> vudu
>> dish622
>> iphone
>> /etc/dnsmasq.conf:
>> # DHCP range for internal LAN/WiFi
>> dhcp-range=lan,,,,12h
>> dhcp-option=lan,3,
>> dhcp-option=lan,6,
>> dhcp-option=lan,42,
>> In this case, I have it giving out dynamic addresses as well as static 
>> ones, but I could do static-only with a line like:
>> dhcp-range=lan,,static,,12h
> Don't forget that you have to tell dnsmasq to read /etc/ethers by adding
> read-ethers
> to /etc/dnsmasq.conf

Ah, right! Thanks very much for catching that, Simon... I do have that 
at the top of my dnsmasq.conf, along with a few other general flags.

One other issue that I remember when I first set this up was that I had 
to double-check the permissions on the files /etc/hosts and /etc/ethers. 
On the system I was on, I think it was initially set up so that they 
weren't world-readable, and dnsmasq was having trouble reading them 
since it ran as "nobody".
Ron Frederick
ronf at timeheart.net

More information about the Dnsmasq-discuss mailing list