[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why is FQDN not found?



On Fri, Jul 27, 2012 at 12:35 PM, Camaleón <noelamac@gmail.com> wrote:
> On Fri, 27 Jul 2012 09:45:02 -0500, Kent West wrote:
>>
>> Why can I ping the hostname, but not the fully-qualified domain name of
>> a box?
>>
>> westk@westek:~$ ping k1000
>> PING k1000.acu.local (150.252.149.1) 56(84) bytes of data. 64 bytes from
>> 150.252.149.1: icmp_req=1 ttl=62 time=0.128 ms ^C64 bytes from
>> 150.252.149.1: icmp_req=2 ttl=62 time=0.138 ms
>>
>> --- k1000.acu.local ping statistics --- 2 packets transmitted, 2
>> received, 0% packet loss, time 5002ms rtt min/avg/max/mdev =
>> 0.128/0.133/0.138/0.005 ms
>
> I remember something related to the "/etc/nsswitch.conf" file, the
> order of the queried facilities and also the avahi issue with ".local"
> domains...
>
> sm01@stt008:~$ cat /etc/nsswitch.conf|grep hosts
> hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
>
> And let's see if I can ping a local machine using its FQDN:
>
> sm01@stt008:~$ ping -c 3 stt008.linux.site
> PING stt008.linux.site (192.168.0.8) 56(84) bytes of data.
> 64 bytes from stt008.linux.site (192.168.0.8): icmp_seq=1 ttl=64 time=0.016 ms
>
> Yes, I can ping *but* I have the above machine listed in my "/etc/hosts"
> file.
>
> sm01@stt008:~$ cat /etc/hosts
> 127.0.0.1       localhost
> 192.168.0.8     stt008.linux.site       stt008
>
> Just for testing purposes yo can try with:
>
> hosts:          files mdns4_minimal dns mdns4
> Or:
> hosts:          files dns mdns4_minimal [NOTFOUND=return] mdns4

Given your "/etc/hosts", you're cheating! :)

Your nsswitch lookup ends at "files" and doesn't use mdns or dns.

"hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4" means that
when your box is resolving an address, it checks "files". If it isn't
in "/etc/hosts", it checks "mdns4_minimal". If this last query
succeeds (basically if a box responds to the multicast query to
224.0.0.251) but the host isn't resolved, the query fails...

Without "[NOTFOUND=return]", the query moves on to "dns", and if that
fails to "mdns4". The difference between "mdns4_minimal" and "mdns4"
is that the former only checks the default mdns ".local" domain.


Reply to: