FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-10-2008, 10:44 PM
"Bernardo Dal Seno"
 
Default system not using hosts file

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.

Ciao
Bernardo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-11-2008, 01:21 AM
"Sudev Barar"
 
Default system not using hosts file

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.

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


--
Regards,
Sudev Barar

Read http://blog.sudev.in for topics ranging from here to there.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-11-2008, 02:15 AM
"Douglas A. Tutty"
 
Default system not using hosts file

On Thu, Apr 10, 2008 at 05:02:14PM -0400, Brian McKee wrote:
>
> I don't understand why 'host fred' doesn't return 127.0.0.1
>
> ==> host -v fred
> Trying "fred.realsubdomain.realdomainname.com"
> Trying "fred.realdomainname.com"
> Trying "fred"
> Host fred not found: 3(NXDOMAIN)
> Received 97 bytes from 192.168.0.2#53 in 0 ms
>
>
> ==> cat /etc/hosts
> 127.0.0.1 localhost.localdomain localhost fred
> 14.0.0.1 fake.fakelocaldomain fred2 fred3
> 192.168.0.11 realhostname.realsubdomain.realdomainname.com
> realhostname
>
> ==> cat /etc/host.conf
> order hosts,bind
> multi on
> nospoof on
> spoofalert on
>
> ==> cat /etc/resolv.conf
> search realsubdomain.realdomainname.com realdomainname.com
> nameserver 192.168.0.2

This should be controlled by nsswitch.conf (config file for the name
service switch).

The hosts line should be:

hosts: files dns
networks: files

Doug.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-11-2008, 03:17 AM
NN_il_Confusionario
 
Default system not using hosts file

On Thu, Apr 10, 2008 at 05:02:14PM -0400, Brian McKee wrote:
> ==> host -v fred
> Received 97 bytes from 192.168.0.2#53 in 0 ms

You probably want

getent hosts fred

the man pages for hosts and getent should explain the differences

--
Chi usa software non libero avvelena anche te. Digli di smettere.
Informatica=arsenico: minime dosi in rari casi patologici, altrimenti letale.
Informatica=bomba: intelligente solo per gli stupidi che ci credono.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-11-2008, 06:08 AM
Bob Cox
 
Default system not using hosts file

On Fri, Apr 11, 2008 at 05:17:56 +0200, NN_il_Confusionario
(pinkof.pallus@tiscalinet.it) wrote:

> You probably want
>
> getent hosts fred
>
> the man pages for hosts and getent should explain the differences

This is something new I learned today - thank you.

And..

On Thu, Apr 10, 2008 at 22:15:37 -0400, Douglas A. Tutty
(dtutty@porchlight.ca) wrote:

> This should be controlled by nsswitch.conf (config file for the name
> service switch).

I had forgotten about this file, so thank you for the reminder. I was
confident that 'ping' would work for the OP because 'host' and 'dig' do
not normally look at the hosts file, but I could not remember why.

--
Bob Cox. Stoke Gifford, near Bristol, UK.
 
Old 04-11-2008, 01:04 PM
Brian McKee
 
Default 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
 
Old 04-13-2008, 06:16 AM
 
Default system not using hosts file

Brian McKee wrote:
> I don't understand why 'host fred' doesn't return 127.0.0.1

Because host is a BIND (Berkeley Internet Name Daemon) command it only
reports DNS data from nameservers. /etc/hosts isn't a nameserver and
so isn't used.

This is also true of the 'dig' command.

There are actually two different 'host' commands. There is the host
command from the host package and the host command from the bind9-host
package. I always use the BIND version of host.

Bob
 

Thread Tools




All times are GMT. The time now is 09:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org