On Fri, Jul 15, 2011 at 01:56:16AM +0100, Freddie Witherden wrote: > On Thu, 14 Jul 2011 09:24:18 +0100, Simon Kelley > <si...@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? >
/etc/ethers is standardized, so I'm not sure that's possible, however it's possible with the directive dhcp-host: (from the manual): | As a special case, it is possible to include more than one hardware | address. eg: --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2 > Regards, Freddie. > > _______________________________________________ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss