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

Re: Proposed new scheme for resolving the system hostname



On Thu, Jun 16, 2005 at 09:38:44PM +0200, Thomas Hood wrote:

> I don't mean that.  I mean that when you do gethostbyname() on the
> system hostname, the h_name you get back is either the system hostname
> or the system hostname with a domain name suffix.

What do you mean by "system hostname"? If you mean the value returned by
gethostname(), then you should be aware that it has _nothing_ to do with
IP networking and it does not have to match the DNS name of any address
configured on any network interface.

In the past when the majority of machines had only one network interface
AND that interface had just one address AND that address was assigned
statically so it was just convinient for gethostname() returning the
same name that was registered in the DNS. Unfortunately this made a lot
of people think that there is a connection between values returned by
gethostname() and names registered in the DNS but this is not true.

Nowadays when mobile devices commonly have multiple interfaces and
dynamic address assignment is widespread the idea that gethostname() has
anything to do with network names simply cannot be uphold anymore.

> This concept goes back a long way and can be found in old UNIX and Sun
> manuals.  If a system has one or more permanently installed NICs with
> statically assigned IP addresses then one of these is regarded as the
> primary one and its address is the one associated with the system
> hostname in /etc/hosts.

As I written above the concept you mention is based on assumptions that
were just convinient defaults at that time but were never granted. And
they are simply not true nowadays.

Gabor

p.s. This is exactly the same as getdomainname() has _nothing_ to do
with DNS domains.

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



Reply to: