1820620 Members
1903 Online
109626 Solutions
New Discussion юеВ

Ping strange behaviour

 
SOLVED
Go to solution
Gordon_3
Regular Advisor

Ping strange behaviour

Hi all,

I have a 11i machine, which I set it to lookup DNS first and then host table, found that if say the entry is in DNS, both nslookup and ping get very fast result, however, when the host is not in DNS but only in /etc/hosts , the nslookup still fine but the ping will get long delay ( ~10sec ) before it giving out the result, any body know why?

Gordon
Gordon
3 REPLIES 3
Michael Steele_2
Honored Contributor
Solution

Re: Ping strange behaviour

Check you nsswitch.conf file to see if it points to the DNS and then files. If DNS then a failure is returned after a failed lookup and before the host file is queried. This would explain some latency.
Support Fatherhood - Stop Family Law
Patrick Wallek
Honored Contributor

Re: Ping strange behaviour

I would solve the problem by putting files first. Why bother with DNS if the IP addy you want is in the /etc/hosts file?

The delay is more than likely due to the fact that ping does have to look up the IP and make it thru all the DNS servers before it goes to /etc/hosts. Even though the nslookup is fine, I would almost bet the delay with ping is during the resolving of host to IP addy.

A. Clay Stephenson
Acclaimed Contributor

Re: Ping strange behaviour

It's because nslookup (as a testtool) doesn't have the same resolver routines as do utilities like ping, telnet, ftp, et. al.

You need to edit /etc/nsswitch.conf and adjust it to suit your needs. Generally the best performance results if a few very frequently used and very seldomly changed hosts are found in /etc/hosts. When NOTFOUND then go to DNS.

The other preference (and generally easier but slightly slower) is to let DNS maintain every host except loopback and the local hostname BUT you must then make sure that you have a robust DNS service with slave servers.
If it ain't broke, I can fix that.