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

Re: where is /etc/hosts supposed to come from?



On Mon, Dec 28, 2009 at 03:52:44AM +0100, Marco d'Itri wrote:

> Considering that any non-trivial server needs to send email out, having
> a working FQDN configured is not "obsolete".

Anything mail related must use /etc/mailname if it needs something that
can be translated to an IP address.

> Your solution to #562780 is broken anyway, /etc/hostname can (and
> actually should) be a FQDN.

No. /etc/hostname has _nothing_ to do with networking. People
historically was lazy to do the proper interface/address enumeration(*)
and instead pretended that /etc/hostname is something resolvable, but it
is simply not true. It may be made to work in some really simple
configurations (read: the host has just a single static IP address), but
it cannot work in any serious server configuration having multiple
interfaces and every interface having multiple addresses.

Anything that uses "fqdn -f" today should really do the following:

    L := empty list
    loop I for all configured interfaces
	loop P for all supported network protocols
	    loop A for all addresses on I of protocol P
		append getnameinfo(A) to L
    remove duplicates from L

Gabor

(*) mostly because doing this enumeration in a portable way is a PITA

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------


Reply to: