Networking Forums

Networking Forums > Computer Networking > Linux Networking > host does not resolve localhost

Reply
Thread Tools Display Modes

host does not resolve localhost

 
 
Alain
Guest
Posts: n/a

 
      11-27-2004, 10:03 AM
hello

I have a strange problem with the hosts file

quering for 127.0.0.1 and localhost does not use the /stc/hosts file
---------------------------
my /etc/host file:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
---------------------------
my resolv.conf
; generated by /sbin/dhclient-script
search athome.be
nameserver 192.168.0.1
---------------------------
my nsswitch.conf

#
# /etc/nsswitch.conf
#
passwd: files
shadow: files
group: files

hosts: files dns

bootparams: nisplus [NOTFOUND=return] files

ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files

netgroup: files

publickey: nisplus

automount: files
aliases: files nisplus
-------------------------
host.conf
order hosts,bind
multi on
-------------------------


then:
host 127.0.0.1
Host 1.0.0.127.in-addr.arpa not found: 2(SERVFAIL)

and
Host localhost not found: 3(NXDOMAIN)

but

ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64
time=0.084 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64
time=0.041 ms

--- localhost.localdomain ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.041/0.062/0.084/0.022 ms

also
ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.040 ms

--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.040/0.042/0.044/0.002 ms


if a put a dummy entry in hosts file eg

10.0.0.10 dummy.domain.org

hosts won't resolve it


I think the problem comes down to the fact that host does not read my
/etc/hosts file but does query the configured DNS instead wich does
not reply for such a query, but how can I setup networking this will
work.

Originally I was testing the openldap suite but tests failed due to
localhost lookup (, and I needed openldap as a JNDI implementation
((
 
Reply With Quote
 
 
 
 
Simon Waters
Guest
Posts: n/a

 
      11-27-2004, 11:39 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alain wrote:
|
.... SNIP long observation on how the 'host' command works.

| Originally I was testing the openldap suite but tests failed due to
| localhost lookup (, and I needed openldap as a JNDI implementation
| ((

Your system appears to be correctly configured, if openldap is
failing to work due to localhost lookup it looks to me like it could
be openldap using the wrong resolver calls. Are you sure this is the
cause?

Either way if you want the "host" command to find the reverse of
localhost, you have to put that reverse data in the DNS, because
host is a DNS lookup tool (as is "dig", and dig makes what is
happening more obvious IMHO).

Debian's BIND9 defaults to having a 127.in-addr.arpa zone locally
with a 1.0.0 entry mapping to localhost.

Also it is suggested in some guidelines to always add "localhost" to
your own (forward) zone files, i.e. so a "localhost.example.com. IN
A 127.0.0.1". Debian's BIND9 also defaults to a "localhost." zone
mapping "localhost." to 127.0.0.1.

If you do all these (and it is overkill) then any "localhost"
related lookup should get the right answer from the first DNS server
it speaks to. But of course if it is in /etc/hosts clients should
rarely get around to asking the DNS for this information, unless
some non-default order of lookup has been specified.
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFBqHVxGFXfHI9FVgYRAinhAKDMpCeRN7fX+i3pNoU9eo 01YTvYaQCdHjtv
GfCpauawFG9x8OaRaMdNFaA=
=qY8g
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Allen Kistler
Guest
Posts: n/a

 
      11-27-2004, 06:29 PM
Alain wrote:
> hello
>
> I have a strange problem with the hosts file
>
> [snip]


It's just a guess, but see if it's really an nscd problem. If nscd is
running, shut it down and try again. I once had some corrupt nscd cache
files that gave me problems similar to yours.
 
Reply With Quote
 
Bill Unruh
Guest
Posts: n/a

 
      11-27-2004, 07:50 PM
(E-Mail Removed) (Alain) writes:

]hello

]I have a strange problem with the hosts file

]quering for 127.0.0.1 and localhost does not use the /stc/hosts file
]---------------------------
]my /etc/host file:

]# Do not remove the following line, or various programs
]# that require network functionality will fail.
]127.0.0.1 localhost.localdomain localhost
]---------------------------
]my resolv.conf
]; generated by /sbin/dhclient-script
]search athome.be
]nameserver 192.168.0.1
]---------------------------
]my nsswitch.conf

]#
]# /etc/nsswitch.conf
]#
]passwd: files
]shadow: files
]group: files

]hosts: files dns

]bootparams: nisplus [NOTFOUND=return] files

]ethers: files
]netmasks: files
]networks: files
]protocols: files
]rpc: files
]services: files

]netgroup: files

]publickey: nisplus

]automount: files
]aliases: files nisplus
]-------------------------
]host.conf
]order hosts,bind
]multi on
]-------------------------


]then:
]host 127.0.0.1
]Host 1.0.0.127.in-addr.arpa not found: 2(SERVFAIL)


host is a DNS lookup utility. DNS, not /etc/hosts.
It does not go to /etc/hosts. It uses dns.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Host-to-host connection in wireless adhoc network? Tim Boneko Linux Networking 0 08-17-2005 05:28 PM
Can Not Resolve Host names =?Utf-8?B?QXR0aWN1cyBGaW5jaA==?= Windows Networking 4 01-16-2005 10:11 PM
Linux<->Windows connection using USB host-to-host cable =?iso-8859-2?Q?Rados=B3aw?= Grzanka Linux Networking 0 04-10-2004 03:23 PM
Access to public host from private host through Linux router Santanu Chatterjee Linux Networking 5 11-14-2003 11:57 PM
Can't resolve by Host Name Sue Windows Networking 0 09-11-2003 08:45 PM



1 2 3 4 5 6 7 8 9 10 11