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

Re: system not using hosts file




On 10-Apr-08, at 9:21 PM, Sudev Barar wrote:
On 11/04/2008, Bernardo Dal Seno <dibbex@gmail.com> wrote:
On 10/04/2008, Bob Cox <debian-user@lists.bobcox.com> wrote:
On Thu, Apr 10, 2008 at 17:02:14 -0400, Brian McKee (map@map- heb.com) wrote:
I don't understand why 'host fred' doesn't return 127.0.0.1

I think host performs a DNS lookup, so maybe it bypasses the file
 hosts altogether.  ping, as Bob
 Cox suggested, should be a better test.


Thank you all for your comments. I did not know that host doesn't look at the hosts file, regardless of the nsswitch and resolv files. Other programs on the box seemed to be resolving 'fred' properly, even though 'host fred' didn't work and I couldn't figure out why.

That is correct as output below shows:
sudev@sudev-804:~$ host localhost
localhost.selfip.org has address 210.24.115.116
sudev@sudev-804:~$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.056 ms

Interestingly, this actually was part of my confusion. In my case 'host localhost' returns 127.0.0.1 Both my dns server and the ISP's dns server return 127.0.0.1 when you ask for localhost.
I didn't realize that wasn't coming from my hosts file....

Most helpful - THANKS!

Brian

Attachment: PGP.sig
Description: This is a digitally signed message part


Reply to: