[Dnsmasq-discuss] "not giving name"

Simon Kelley simon at thekelleys.org.uk
Mon Oct 1 11:57:57 BST 2007


Carlos Carvalho wrote:
> dnsmasq sometimes refuses to send a name to a host with the msg:
> 
> not giving name aar to the DHCP lease of 192.168.3.141 because the name exists in /etc/dnsmasq/hosts with address 192.168.97.141
> 
> This is correct. The problem is that the department is divided in
> vlans, and the same machine gets different IPs when connected to
> points in different vlans.
> 
> I wonder if dnsmasq should send the name if it finds it corresponding
> to that IP in a config file, even if the name is repeated. Perhaps
> just a warning could be put in the log... Opinions?
> 

I can't see how this would work: take this scenario.

Three different networks:

192.168.1.x
192.168.2.x
192.168.3.x

Host can appear on any of them, so you put

192.168.1.100 myhost
192.168.2.100 myhost
192.168.3.100 myhost

in /etc/hosts.

Host gets a lease on 192.168.1.100 and you want to contact the host from
elsewhere, so you do a DNS lookup on "myhost". The DNS query returns all
three addresses, and only the first is used. The order of the addresses
as always changing, so there is only a one in three chance that you get
the current address of myhost, and a two in three chance that you get
one of the other addresses which won't work.

You can read the message as a warning "I want to associate name 'x' with
exactly one address 'A', but the contents of /etc/hosts stops me from
doing that." In fact the current code can be fooled, since it just looks
at one address: really it should  check all the addresses associated
with the name and complain is there is more than one.

The altenative, which _does_ work, is to use dhcp-host

dhcp-host=myhost,192.168.1.100
dhcp-host=myhost,192.168.2.100
dhcp-host=myhost,192.168.3.100

Now dnsmasq will pick the host line which fits the current network, and
insert only that address into DNS: DNS queries will always get the
correct answer.

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list