Should /etc/hostname contain the whole FQDN?
I have been trying to find out the exact and proper way to set the host and
domain name on Debian and it's clear as mud. Searching the internet gives all
sorts of conflicting answers.
First, I thought the way to do it was to put the FQDN in /etc/hostname. Then I
ended up with host.domain.domain.tld (maybe I caused that some other way).
I looked at the default in a variety of Debian systems that I've setup using
only thing installer defaults to configure the hostname. Some had only the
hostname in /etc/hosts, some had the FQDN.
I've read the hostname manpage. It says clearly:
"It is not possible to set the FQDN or the DNS domain name with the
Then it says
"The host name is usually set once at system startup in /etc/rc.d/rc.inet1
or /etc/init.d/boot (normally by reading the contents of a file which
contains the host name, e.g. /etc/hostname)"
Those first 2 files don't exist on Debian Etch. And thought it says it usually
gets the hostname from /etc/hostname, that still doesn't tell me if that
should contain the hostname or the FQDN.
Then it says "The FQDN of the system is the name that the resolver(3) returns
for the host name."
Ok, so what's the resolver?
man 3 resolver returns nothing
man resolver talks about /etc/resolv.conf.
It does talking about setting "domain", then it says search and domain are
mutually exclusive. So while /etc/resolv.conf may have some effect on the
hostname, it surely isn't THE way the system gets it's FQDN.
Back to hostname man page:
"Technically: The FQDN is the name gethostbyname(2) returns for the host name
returned by gethostname(2). The DNS domain name is the part after the first
(where does gethostbyname(2) and gethostname(2) look?)
"Therefore it depends on the configuration (usually in /etc/host.conf) how you
can change it. Usually (if the hosts file is parsed before DNS or NIS) you
can change it in /etc/hosts."
My /etc/host.conf contains this:
So that's still not where it's set. Manpage for hosts.conf says multi:
"If set to on, the resolv+ library will return all valid addresses for a host
that appears in the /etc/hosts file, instead of only the first."
So that's how it looks up IP<-> name mappings, but that /still/ doens't tell
me how to set my FQDN.
Can anyone who /knows/ tell me what the proper officially correct ways of
setting the hostname and the FQDN are, please?