[Dnsmasq-discuss] Question

rance at frontiernet.net rance at frontiernet.net
Fri Jan 25 19:17:35 GMT 2008


Quoting Ron Frederick <ronf at timeheart.net>:

> rance at frontiernet.net wrote:
>> Quoting Heath Woodson <heathwoodson at gmail.com>:
>>
>>> Setting this up for the first time and I have a simple question but it isnt
>>> clearly answered anywhere. I want to assign ips with DHCP in a   
>>> static manner
>>> can I just use the /etc/host file on the machine running dnsmasq to do this
>>> and uncomment this line
>>> # 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
>>>
>>> or is it better to use the MAC address lines presented like below?
>>>
>>> # Always allocate the host with ethernet address 11:22:33:44:55:66
>>> # The IP address 192.168.0.60
>>> #dhcp-host=00:11:22:33:44:55,192.168.0.60
>>>
>>> and will either of these work without uncommenting the range line below(It
>>> sounds like it wont work without this but i dont want any dynamically
>>> assigned IPS..)
>>> # Uncomment this to enable the integrated DHCP server, you need
>>> # to supply the range of addresses available for lease and optionally
>>> # a lease time. If you have more than one network, you will need to
>>> # repeat this for each network on which you want to supply DHCP
>>> # service.
>>> #dhcp-range=192.168.0.50,192.168.0.150,12h
>>>
>>> thanks for your help in advance
>>>
>>> H
>>>
>>
>> Just a word of warning, NOT EVERY dhcp client sends a hostname by   
>> default, if you have a dhcp configuration based on hostname, then   
>> it is essential that the dhcp clients all send hostnames in the   
>> request packet.
>>
>> Windows by default does this, but linux usually doesn't.
>>
>> On linux boxes you need to edit/create a dhclient.conf file in the   
>> location your distro expects to find it.
>>
>> This file will make sure that dhclient sends a hostname.
>
> 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:
>
> 192.168.1.3 powerbook
> 192.168.1.4 slingbox
> 192.168.1.5 sipura
> 192.168.1.6 vudu
> 192.168.1.7 dish622
> 192.168.1.8 iphone
>
> /etc/dnsmasq.conf:
>
> # DHCP range for internal LAN/WiFi
> dhcp-range=lan,192.168.1.128,192.168.1.254,255.255.255.0,12h
> dhcp-option=lan,3,192.168.1.1
> dhcp-option=lan,6,192.168.1.1
> dhcp-option=lan,42,192.168.1.1
>
> 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,192.168.1.0,static,255.255.255.0,12h
> -- 
> Ron Frederick
> ronf at timeheart.net
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

I learned something here, very nice work Ron




More information about the Dnsmasq-discuss mailing list