Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- From: jrw32982@xxxxxxxxx
- Date: Thu, 07 Jun 2007 21:28:32 -0700
On Jun 7, 9:33 pm, Barry Margolin <bar...@xxxxxxxxxxxx> wrote:
gethostbyname() uses whatever methods are specified for host resolution
in /etc/nsswitch.conf. It's a general-purpose name resolution library,
which can look in /etc/hosts, use DNS, use NIS, etc.
Thanks for your reply. I'm trying to determine the names/aliases/IP
addresses for the current server by recursively calling
gethostbyname() and gethostbyaddr(), starting with $(/bin/hostname).
However, my sysadmin has set up /etc/hosts (which is specified before
DNS in /etc/nsswitch.conf) to contain HOSTNAME on the 127.0.0.1 line.
This thwarts my attempt to determine the real IP address for HOSTNAME
which is specified later in /etc/hosts.
Is there some other API that I should call to get aliases and IP
addresses for HOSTNAME? Or should I tell my sysadmin to remove
HOSTNAME from the 127.0.0.1 line? I am unable to find a definitive
reference which says that a server (on a network) should not have
HOSTNAME on the 127.0.0.1 line.
-- John
.
- Follow-Ups:
- Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- From: Barry Margolin
- Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- References:
- host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- From: jrw32982
- Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- From: Barry Margolin
- host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- Prev by Date: Re: Pretending to be a network node
- Next by Date: Re: Pretending to be a network node
- Previous by thread: Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- Next by thread: Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
- Index(es):
Relevant Pages
|
|