/etc/hosts being ignored?

/etc/hosts being ignored?

Post by Josh » Wed, 26 Dec 2001 19:00:33



My /etc/hosts file seems to be ignored when I use programs like "ping."
for my localhost (127.0.0.1) I have a host name, but this isn't being
used when I try to ping it.  My /etc/host.conf file has the proper
configuration as well:

order hosts,bind
multi on

But still nothing.  The network works fine, but hostname lookups from
/etc/hosts isn't.  Could anyone provide any help?
Thank you,
Josh.

 
 
 

/etc/hosts being ignored?

Post by Lurc » Wed, 26 Dec 2001 21:48:24



> My /etc/hosts file seems to be ignored when I use programs like "ping."
> for my localhost (127.0.0.1) I have a host name, but this isn't being
> used when I try to ping it.  My /etc/host.conf file has the proper
> configuration as well:

Does the folowing command return anything?
strace ping localhost >& tst.tmp && grep /etc/hosts tst.tmp && rm tst.tmp

--
Home: http://users.skynet.be/bk333466/
OS: RedHat Linux 7.2 (kernel 2.4.17)
X: KDE 2.2.2-1 (XFree86-4.1.0-3, QT-2.3.2-1)

 
 
 

/etc/hosts being ignored?

Post by David Goldstei » Wed, 26 Dec 2001 22:11:29



> My /etc/hosts file seems to be ignored when I use programs like "ping."
> for my localhost (127.0.0.1) I have a host name, but this isn't being
> used when I try to ping it.  My /etc/host.conf file has the proper
> configuration as well:

> order hosts,bind
> multi on

> But still nothing.  The network works fine, but hostname lookups from
> /etc/hosts isn't.  Could anyone provide any help?

  What does your hosts file look like? When you edit/create this file,
you should have something that looks like this:

192.168.0.1             mybox.linux     mybox

  This should appear for all of the boxes in your local network, with
the appropriate ip addresses and names. If it does, then a simple ping
mybox should work with no problem.

Quote:> Thank you,
> Josh.

David
 
 
 

/etc/hosts being ignored?

Post by Josh » Thu, 27 Dec 2001 07:13:53





>> My /etc/hosts file seems to be ignored when I use programs like "ping."
>> for my localhost (127.0.0.1) I have a host name, but this isn't being
>> used when I try to ping it.  My /etc/host.conf file has the proper
>> configuration as well:

> Does the folowing command return anything?
> strace ping localhost >& tst.tmp && grep /etc/hosts tst.tmp && rm tst.tmp

  No, that command does not return any output.  I can "ping localhost"
but it doesn't read anything else from /etc/hosts.

Here is my /etc/hosts file:

127.0.0.1       localhost.localdomain   localhost       hewbert
24.253.11.221   cd585345-e.rpdcty1.sd.home.com  cd585345-e
192.168.0.112   hewbert-l
192.168.0.3     josh

I can't ping "localhost.localdomain" or "josh" or the others.

/etc/host.conf (as mentioned before) is setup like the following:
order hosts,bind

Thank you,
        Josh.

 
 
 

/etc/hosts being ignored?

Post by Josh » Thu, 27 Dec 2001 07:16:01





>> My /etc/hosts file seems to be ignored when I use programs like "ping."
>> for my localhost (127.0.0.1) I have a host name, but this isn't being
>> used when I try to ping it.  My /etc/host.conf file has the proper
>> configuration as well:

>> order hosts,bind
>> multi on

>> But still nothing.  The network works fine, but hostname lookups from
>> /etc/hosts isn't.  Could anyone provide any help?

>   What does your hosts file look like? When you edit/create this file,
> you should have something that looks like this:

> 192.168.0.1                mybox.linux     mybox

As posted before, here's my /etc/hosts file:

127.0.0.1       localhost.localdomain   localhost       hewbert
24.253.11.221   cd585345-e.rpdcty1.sd.home.com  cd585345-e
192.168.0.112   hewbert-l
192.168.0.3     josh

Quote:

>   This should appear for all of the boxes in your local network, with
> the appropriate ip addresses and names. If it does, then a simple ping
> mybox should work with no problem.

I have the box's 2 cards included as well as another local machine.
However, a "ping josh" or a "ping hewbert-l" doesn't work.  "ping
localhost.localdomain" doesn't even work?

Quote:

>> Thank you,
>> Josh.

> David

Josh.
 
 
 

/etc/hosts being ignored?

Post by Bit Twist » Thu, 27 Dec 2001 07:59:03


try adding something like
domain invalid  <=============== this is my lan domain, use yours
search localdomain rpdcty1.sd.home.com home.com
to /etc/resolv.conf


> My /etc/hosts file seems to be ignored when I use programs like "ping."
> for my localhost (127.0.0.1) I have a host name, but this isn't being
> used when I try to ping it.  My /etc/host.conf file has the proper
> configuration as well:

> order hosts,bind
> multi on

> But still nothing.  The network works fine, but hostname lookups from
> /etc/hosts isn't.  Could anyone provide any help?
> Thank you,
> Josh.

--
The warranty and liability expired as you read this message.
If the above breaks your system, it's yours and you keep both pieces.
Practice safe computing. Backup the file before you change it.
Do a,  man command_here or cat command_here, before using it.
 
 
 

/etc/hosts being ignored?

Post by Lurc » Thu, 27 Dec 2001 09:02:47




>> Does the folowing command return anything?
>> strace ping localhost >& tst.tmp && grep /etc/hosts tst.tmp && rm tst.tmp


> No, that command does not return any output.  I can "ping localhost"
> but it doesn't read anything else from /etc/hosts.

Strange...

Do you have a line like
hosts:      files nisplus dns
in /etc/nsswitch.conf

--
Home: http://users.skynet.be/bk333466/
OS: RedHat Linux 7.2 (kernel 2.4.17)
X: KDE 2.2.2-1 (XFree86-4.1.0-3, QT-2.3.2-1)

 
 
 

/etc/hosts being ignored?

Post by Al Tuttl » Fri, 28 Dec 2001 00:27:41






> >> My /etc/hosts file seems to be ignored when I use programs like "ping."
> >> for my localhost (127.0.0.1) I have a host name, but this isn't being
> >> used when I try to ping it.  My /etc/host.conf file has the proper
> >> configuration as well:

> > Does the folowing command return anything?
> > strace ping localhost >& tst.tmp && grep /etc/hosts tst.tmp && rm tst.tmp

>   No, that command does not return any output.  I can "ping localhost"
> but it doesn't read anything else from /etc/hosts.

> Here is my /etc/hosts file:

> 127.0.0.1       localhost.localdomain   localhost       hewbert
> 24.253.11.221   cd585345-e.rpdcty1.sd.home.com  cd585345-e
> 192.168.0.112   hewbert-l
> 192.168.0.3     josh

> I can't ping "localhost.localdomain" or "josh" or the others.

> /etc/host.conf (as mentioned before) is setup like the following:
> order hosts,bind

> Thank you,
>         Josh.

Hmmm....  your hosts file looks strange to me. I would think it would
be:

127.0.0.1       localhost
24.253.11.221   cd585345-e.rpdcty1.sd.home.com  cd585345-e
192.168.0.112   hewbert-l.<yerdomain>    hewbert-l
192.168.0.3     josh.<yerdomain>         josh

But then maybe I come from a simpler time.

---- The Key is knowing how to use your neurosis. ----

        Linux - The Choice of the GNU generation

 
 
 

1. getaddrinfo acts very strangely (ignores /etc/hosts.conf)

The new resolver routine, getaddrinfo() (which is an IPV6 ready
replacement for gethostbyname()) seems to be acting very strangely.

I have a host.conf file which has the line
hosts,bind
which should ( and for gethostbyname does) say to get the address from
hosts, and only if it is not located in hosts, go to dns nameserver for
the address. Unfortunately, what getaddrinfo actually does is, after
reading /etc/host.conf, to first read /etc/hosts (which does contain
the name and IP address required), then to go to /etc/resolv.conf and
query the nameservers in there again. then go back to /etc/hosts.

In my case I am trying to use ssh between two machines on a home net (or
today on a net where the router to the outside world died) and it took
two min or so to make the connection. Doing traceroute showed the above
weird behaviour ( and putting debugging printouts into sshconnect.c
showed it was the getaddrinfo call which was the problem).
What is going on with getaddrinfo? This seems like a definite bug. The
whole pupose of /etc/hosts is to replace dns for a given set of
addresses (especially in cases where the dns server may only be on line
occasionally).

Does anyone understand this weird behaviour?

2. Visualworks/Smalltalk for Linux ?

3. Konqueror Ignoring /etc/hosts

4. Nvidia Drivers??

5. Is there am MAXIMUM size for etc/host names

6. BASIC on UNIX

7. /etc/hosts.deny & /etc/hosts.allow ??

8. Adding a NIC

9. reverse name resolver ignoring /etc/hosts

10. /etc/hosts.deny and /etc/hosts.allow

11. /etc/hosts ignored

12. Now that resolver is used, mail ignores 'mailhost' in /etc/hosts

13. /etc/hosts (or NIS host map): official-host-name vs nicknames