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

Re: /etc/hostname



On Thu, May 29, 2003 at 03:43:56PM +0400, Nikita V. Youshchenko wrote:
> Should /etc/hostname contain only short hostname, or FQDN name?
> Is this documented anywhere?

There is no real standard on this. Both is possible. Most Software works
like this:

- if you need a unqualified hostname, use the hostname set in kernel (same
as /etc/hostname)

- if you need a qualified hostname, look up the hostname set in kernel with
the resolver and use the qualified alias)

This is how the hostname utility works also.

You can clearly see, that there is no difference for those applications in
the result, as long as the qualified hostname and the unqualified hostname
is lookable.

calista:/home/ecki# hostname calista
calista:/home/ecki# hostname -v -f
gethostname()=alista'
Resolving alista' ...
Result: h_name=alista.inka.de'
Result: h_aliases=alista'
Result: h_aliases=alista.eckenfels.net'
Result: h_aliases=ckenfels.net'
Result: h_aliases=eb.eckenfels.net'
Result: h_aliases=lash.eckenfels.net'
Result: h_aliases=enca.eckenfels.net'
Result: h_aliases=enra.eckenfels.net'
Result: h_aliases=ecure.eckenfels.net'
Result: h_addr_list=0.0.3'
calista.inka.de
calista:/home/ecki# hostname calista.inka.de
calista:/home/ecki# hostname -v -f
gethostname()=alista.inka.de'
Resolving alista.inka.de' ...
Result: h_name=alista.inka.de'
Result: h_aliases=alista'
Result: h_aliases=alista.eckenfels.net'
Result: h_aliases=ckenfels.net'
Result: h_aliases=eb.eckenfels.net'
Result: h_aliases=lash.eckenfels.net'
Result: h_aliases=enca.eckenfels.net'
Result: h_aliases=enra.eckenfels.net'
Result: h_aliases=ecure.eckenfels.net'
Result: h_addr_list=0.0.3'
calista.inka.de

> I've always thougth that /etc/hostname should contain short hostname.
> But e.g. etherconf package puts FQDN name there ...

Using the FQDN has advantages: the lookup will be more reliable finding the
right entry (e.g. "www") and it has disadvantages: it may cvonfuse the user,
if the hostname contains a qualified address which is not found in dns.


Greetings
Bernd (net-tools upstream maintainer)
-- 
  (OO)      -- Bernd_Eckenfels@Wendelinusstrasse39.76646Bruchsal.de --
 ( .. )  ecki@{inka.de,linux.de,debian.org} http://home.pages.de/~eckes/
  o--o     *plush*  2048/93600EFD  eckes@irc  +497257930613  BE5-RIPE
(O____O)  When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!



Reply to: