Re: Debian and FQDN lookup
Hi.
On Thu, 02 Apr 2015 14:54:19 +0200
Alex Mestiashvili <alex@biotec.tu-dresden.de> wrote:
> the mechanism is described here:
>
> http://sources.debian.net/src/hostname/3.15/hostname.c/
>
> and as far as I see it simply asks the DNS about the hostname using
> getaddrinfo.
But, with stock nsswitch.conf, it issues uname(2) syscall first, goes
to /etc/hosts second, and if it encounters FQDN hostname - it all ends
here.
If /etc/hosts contain only bare hostname - it'd return a bare hostname.
Only if /etc/hosts does not contain a hostname - a DNS search will be
performed (or other resolving method, all according to nsswitch.conf).
> On my system the "--fqdn" flag doesn't work if my /etc/resolv.conf
> doesn't have domain <mydomain> or search <mydomain> option enabled.
Or it's because you have a bare hostname in /etc/hosts ;)
> You can see it with strace hostname --fqdn.
All this invaluable information above was provided you by strace :)
Reco
Reply to: