[Dnsmasq-discuss] Can dnsmasq 'alias' a host name?
Simon Kelley
simon at thekelleys.org.uk
Wed Sep 2 20:59:54 BST 2009
Chris G wrote:
> On Wed, Sep 02, 2009 at 08:46:01PM +0100, Simon Kelley wrote:
>> Chris G wrote:
>>> On Wed, Sep 02, 2009 at 05:51:15PM +0100, Simon Kelley wrote:
>>>> Chris G wrote:
>>>>> Can dnsmasq provide an alternative name for a client?
>>>>>
>>>>> This is going on from my problem with a system that insists on calling
>>>>> itself garage.local when I want it to be called garage.
>>>>>
>>>>> Is there a way that I can tell dnsmasq that garage.local is also
>>>>> garage so that requests for the address of garage will get the address
>>>>> of garage.local?
>>>>>
>>>> yes.
>>>>
>>>>
>>>> cname=garage,garage.local
>>>>
>>>> should do it.
>>>>
>>> It doesn't seem to work though. I have added the following to the end
>>> of /etc/dnsmasq.conf :-
>>>
>>> cname=garage,garage.local
>>>
>>> I have killed and restarted dnsmasq (it's still providing DNS OK).
>>>
>>> However I can't ping or ssh to garage, but I can ping and ssh to
>>> garage.local.
>>>
>>>
>> The fact that this thing is putting .local on the end of its name
>> suggests that is might be doing mDNS, and that the host you are testing
>> it with is also configured to use mDNS as a name-resolution method.
>> Since dnsmasq doesn't have anything to do with mDNS, it can't affect that.
>>
>> Some things to check:
>>
>> 1) /var/lib/misc/dnsmasq.leases. Does the garage.local name appear
>> there, it will if the NAS is announcing that name in its DHCP requests.
>>
> /var/lib/misc/dnsmasq.leases contains:-
>
> 1251924290 00:0b:5d:7f:56:e0 192.168.1.90 MAXLAPTOP 01:00:0b:5d:7f:56:e0
> 1251923804 00:01:e3:9d:8b:b5 192.168.1.129 C475IP *
> 1251923525 08:00:27:24:d0:9c 192.168.1.144 xp 01:08:00:27:24:d0:9c
> 1251922953 00:90:a9:70:06:ff 192.168.1.88 * 01:00:90:a9:70:06:ff
> 1251923251 00:e0:4c:c0:a9:60 192.168.1.89 lounge *
> 1251923827 00:50:8d:93:fd:09 192.168.1.83 maxine *
>
> That 192.168.1.88 is the garage system.
>
>
>> 2) /etc/nsswitch.conf does mdns appear in the hosts: line?
>>
> Yes:-
>
> hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
>
>
>> 3) Try "dig garage.local" which just does a DNS query and doesn't try
>> the other name-resolution methods.
>>
> ; <<>> DiG 9.5.1-P2 <<>> garage.local
> ;; global options: printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 10135
> ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
>
> ;; QUESTION SECTION:
> ;garage.local. IN A
>
> ;; Query time: 0 msec
> ;; SERVER: 127.0.0.1#53(127.0.0.1)
> ;; WHEN: Wed Sep 2 20:49:35 2009
> ;; MSG SIZE rcvd: 30
>
>> There are ways around this, but we need to know exactly what's going on
>> first.
>>
> Thanks for all the help so far. Yes, I think mDNS may be getting in
> the way. Turning it off is fine, especially if I can just persuade
> the garage system to be 'normal'! :-)
>
> The garage system has the following running:-
> 3817 root 1024 S /usr/bin/mDNSResponder -f /etc/mDNSResponder.conf
> 3818 root 1024 S /usr/bin/mDNSResponder -f /etc/mDNSResponder.conf
> 3819 root 1024 S /usr/bin/mDNSResponder -f /etc/mDNSResponder.conf
>
Yes, that name is coming from mDNS, and not from the NAS announcing its
name when it does DHCP.
You need to stop using mDNS for name resolution (edit
/etc/nsswitch.conf) and then, since the NAS doesn't tell dnsmasq its
name, you need to tell dnsmasq that the host with MAC address
00:90:a9:70:06:ff is "garage".
dhcp-host=00:90:a9:70:06:ff,garage
you can remove the CNAME line too, it's not needed.
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list