On 04/02/2015 02:10 PM, Mihamina Rakotomandimby wrote:
Hi al,
WHen issuing 'hostname --fqdn', I'm supposed to get the FQDN.
Anyway when trying some different combinations, involving
/etc/hostname, /etc/domainname, /etc/hosts, /etc/resolv.conf, I cannot
figure out where the FQDN is looked up AND with what precedence.
Would you know the mechanism (precedence) and worlkflow where a Debian
7 machine gets its FQDN?
Thank you.
Hi,
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.
On my system the "--fqdn" flag doesn't work if my /etc/resolv.conf
doesn't have domain <mydomain> or search <mydomain> option enabled.
You can see it with strace hostname --fqdn.
Also see man resolver for additional information.
Alex
|
|