Operating System - HP-UX
1833176 Members
2952 Online
110051 Solutions
New Discussion

Re: Ping will not ping host name in /etc/hosts table

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Ping will not ping host name in /etc/hosts table

I'm having a problem with pinging hosts that reside in the /etc/hosts table. I can ping the ip address but cannot ping the host name referenced by the ip address.
We are running dns. hosts is accessed after dns.

Host name get resolved successfully via nslookup.

Any ideas? Host names contain underscores '_'

9 REPLIES 9
Berlene Herren
Honored Contributor

Re: Ping will not ping host name in /etc/hosts table

that does sound like a name resolution issue, or else a bad patch. (PHCO_19691). There is also a problem with 11.0 and the nslookup binary if the nsswitch.conf is set to dns then files. It will not look at files. Try switching those around, or, if you have a working 10.20, copy the nslookup binary over, then try. This was also fixed with the latest BIND patch.

Berlene
http://www.mindspring.com/~bkherren/dobes/index.htm
Darrel Louis
Honored Contributor

Re: Ping will not ping host name in /etc/hosts table

Jack,

Don't know which bind version you're running:
Starting with BIND 4.9.6, hostnames cannot
contain the underscore.

If you've the underscore in you DNS table, you need to change it and rebuild the DNS database.

How does your nsswitch.conf file look like.

Do a nslookup
nslookup
nslookup

The output should be the same.

Good Luck

Darrel
Bruce Regittko_1
Esteemed Contributor

Re: Ping will not ping host name in /etc/hosts table

Hi,

Make sure that the entries in /etc/hosts begin in column 1. Leading spaces and/or tabs are not allowed.

--Bruce
www.stratech.com/training
Jack C. Mahaffey
Super Advisor

Re: Ping will not ping host name in /etc/hosts table

Contents of /etc/nsswitch.conf:
dns: files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] hosts

Contents of /etc/resolv.conf
domain mead.com
nameserver n.n.n.n
nameserver n.n.n.n
nameserver n.n.n.n
#nameserver n.n.n.n
#search
#nameserver n.n.n.n
#nameserver n.n.n.n


Does ping run nslookup?
Jack C. Mahaffey
Super Advisor

Re: Ping will not ping host name in /etc/hosts table

I see what's wrong.. First entry should be hosts:


Oh well.


Thanks for the help to all..
Berlene Herren
Honored Contributor
Solution

Re: Ping will not ping host name in /etc/hosts table

Jack, your nsswitch.conf should look something like this:

hosts: files [notfound=continue] dns

The only three recognized vehicles for name resolution are dns, nis and files (files being your /etc/hosts).

See the man page for switch for more information.


If you type
#nslookup
>policy

What does it return for the number of lookups?

Berlene

http://www.mindspring.com/~bkherren/dobes/index.htm
Jack C. Mahaffey
Super Advisor

Re: Ping will not ping host name in /etc/hosts table

/etc/nsswitch.conf now looks like the following:
hosts: files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] dns [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue]
passwd: files
group: files

ping is now working because I fixed a typo.

entering policy while in nslookup returned the following:
#Lookups = 2
files [RCCC] dns [RRRR]

Thanks for the help. I'm not real sure why all the NOTFOUND, UNAVAIL and TRYAGAIN are included....



Dan Hetzel
Honored Contributor

Re: Ping will not ping host name in /etc/hosts table

Hi Jack,

You don't need that much, the following line would be enough (for hosts):

hosts: files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] dns

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Jack C. Mahaffey
Super Advisor

Re: Ping will not ping host name in /etc/hosts table

Thanks to all...