Hostname not respecting search domain
Andrew Langhorn
andrew at ajlanghorn.com
Thu Aug 6 22:37:58 UTC 2015
Hi Brandon,
Thanks; that makes sense. I've added an entry to /etc/hosts, and it's working much better now.
Andrew
________________________________________
From: ubuntu-users-bounces at lists.ubuntu.com <ubuntu-users-bounces at lists.ubuntu.com> on behalf of Brandon Vincent <Brandon.Vincent at asu.edu>
Sent: 06 August 2015 23:32
To: Ubuntu user technical support, not for general discussions
Subject: Re: Hostname not respecting search domain
On Thu, Aug 6, 2015 at 2:06 PM, Andrew Langhorn <andrew at ajlanghorn.com> wrote:
> There is a search domain set in `/etc/network/interfaces` and I've given one
> to `/etc/resolv.conf` using resolvconf, specifying the correct network
> interface.
The hostname(1) utility utilizes the name resolution functions of
glibc to return various information about the system. The search list
and domain options in /etc/resolv.conf relate to how the glibc
resolver constructs DNS queries.
When you run hostname -f, the system first takes the system hostname
(e.g. test01) and attempts to get a hostent structure (name and IP
address) in return. It first tries to do this by looking for an entry
in /etc/hosts. If no entry exists, the glibc resolver will make DNS
queries for test01 with various combinations of the default domain and
search list appended until it recieves a result. There are other ways
glibc can return a hostname (e.g. myhostname), but this is usually the
default.
hostname -f, then takes this hostent structure and uses the portion
after the first dot as the returned domain name.
If you want the system to return an entry for hostname -f, your
options are to change your hostname to the FQDN, add an entry to
/etc/hosts, or to get a proper DNS infrastructure in place.
Brandon Vincent
--
ubuntu-users mailing list
ubuntu-users at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
More information about the ubuntu-users
mailing list