Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)



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

.



Relevant Pages

  • Re: adding a second nic
    ... > internal Active Directory domain zone. ... with a gateway of 192.168.1.1 and assign it in DNS as a domain name ... and use that as my internet connection ... on 192.168.1.200 called outside, with hostname ohostname. ...
    (microsoft.public.win2000.dns)
  • Re: Security flaw in ALCATEL/THOMSON Speed Touch Pro ADSL modems
    ... | because it's a way DHCP and DNS are supposed to work and it's ... firmware simply doesn't validate any further Hostname given to it, ... this flaw allows to corrupt the local zone file ...
    (Bugtraq)
  • Re: host $(/bin/hostname) differs from gethostbyname(HOSTNAME)
    ... gethostbyname() and gethostbyaddr, starting with $. ... 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. ...
    (comp.unix.admin)
  • Re: Bug in Graphical Network Configuration???
    ... I have assigned the static address for my FC5 box because I am serving ... FC5 box has something to do with the Samba since windows machines uses ... addresses - it might add them (machine hostname and FQDN) to the ... The ISP's DNS server numerical IP addresses. ...
    (Fedora)
  • Re: IP ADDRESS
    ... to me with the least amount of client machine configuration or programming. ... machines in DNS or RDNS, or that you have them all in DNS & RDNS. ... GET THE HOSTNAME FOR THE DEVICE ... FOR PTR = 1 TO LNS ...
    (comp.databases.pick)