[Dnsmasq-discuss] Remembering DHCP Assignments

Freddie Witherden freddie at witherden.org
Fri Jul 15 01:56:16 BST 2011


On Thu, 14 Jul 2011 09:24:18 +0100, Simon Kelley
<simon at thekelleys.org.uk> wrote:
> Dnsmasq attempts to do that same thing, but the implementation is a bit
> different. Instead of keeping records of all clients almost forever, it
> allocates IP addresses using a hash of the client's MAC address, so
> normally the same client should always get the same address. To make
> this work well, the size of the DHCP address range should ideally be
> much larger than the number of clients. If you have ten IP addresses and
> nine clients, then hash collisions will mean that the IP address
> allocations are essentially random. If you have 250 IP addresses and
> nine clients, then there will probably be no collisions, and a client
> will always get the same IP address.
> 
> Another option to consider is to make DHCP lease times infinite, that
> will give the same address every time, but might risk running out of
> addresses long-term is the set of clients changes over time.
> 
> Finally, if the only reason you care about long-term stable addresses is
> for naming in /etc/hosts, then consider moving that information to the
> dnsmasq configuration and mapping names to MAC addresses instead.
> 
> dhcp-host=11:22:33:44:55:66,mylaptop
> 
> that way stable IP addresses are not required. (See also --read-ethers),
> you can keep this mapping in /etc/ethers rather than the dnsmasq
> configuration file if that suits.)

Thank you for this.  /etc/ethers and /etc/hosts is quite a nice
solution.  However, I do have one query regarding mapping multiple
MACs/IP addresses to a single host.  Several devices on my network have
both wired and wireless adapters and it would be nice if both could
share the same hostname; under the assumption that the two will never be
connected at the same time.  Is this possible with /etc/ethers?

Regards, Freddie.



More information about the Dnsmasq-discuss mailing list