On 10-Apr-08, at 9:21 PM, Sudev Barar wrote:
On 11/04/2008, Bernardo Dal Seno <email@example.com> wrote:On 10/04/2008, Bob Cox <firstname.lastname@example.org> 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.1I 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 126.96.36.199 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
Description: This is a digitally signed message part