Bug 68212 - ping name resolving
ping name resolving
Product: Red Hat Linux
Classification: Retired
Component: iputils (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2002-07-08 03:21 EDT by Phil Quiney
Modified: 2015-03-04 20:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-05-15 10:45:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Phil Quiney 2002-07-08 03:21:44 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020530

Description of problem:
When using ping to a host name, it performs a DNS lookup on the hostname before
sending each ping packet (that is once per second). This is 'new' (& unwanted)
behaviour AFAIK.Pinging to an IP address works as expected.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Start tcpdump or ethereal monitoring network/hosts involved
2. ping somehostname # Note hostname not in /etc/hosts
3. Observe DNS lookups on link at same rate as Ping packets for the host being
4. Say to yourself "This is a bug"

Additional info:
Comment 1 Phil Knirsch 2002-07-17 08:28:15 EDT
Ahhh! Thats a good info! I've had several other reports with timeouts and
package loss when using hostnames resolved via DNS instead of in /etc/hosts or
with direct IPs with ping. That might be the reason why.

Thanks for spotting that, will fix.

Read ya, Phil
Comment 2 Phil Knirsch 2003-05-15 04:53:59 EDT
OK, after checking the latest versions the problem seems to be that ping uses
gethostbyaddr() for every package. With the -n option you can prevent that.

I have tested with various sites and using an IP or a name on the commandline
and the output always looked the same, so i honestly wonder where the difference
really is. :-)

So the simple solution for now is to use the -n option in your scripts. I'll
look into reverting the behaviour to the old style (as i also think that a DNS
call for every single package is a little bit of an overkill).

Read ya, Phil
Comment 3 Phil Quiney 2003-05-15 05:09:36 EDT

Using'gethostbyname' for every ping packet is just *WRONG*. Consider what would
happen trying to do a 'flood' ping (ping -f) to a named host; you flood your
network with both DNS lookups as well as the ping packets.

This is definitely not expected behaviour.

(At least this version of ping dosen't complain about 'time of day goes back...'
even between NTP synced machines, like on RH7.2) ;-)


Phil Q
Comment 4 Phil Knirsch 2003-05-15 06:11:22 EDT
Urgs, yes, true. I just checked and got a factor of 3 in running time in our
local network! Thats really bad. Will fix. :-)

Read ya, Phil

PS: With nscd running on the local machine things will work nicely again, too,
as the nscd will cache that DNS query.
Comment 5 Phil Knirsch 2003-05-15 10:45:58 EDT
OK, just made a patch. It now caches internally the last printed address. Works
fine for me now and will be in the next rawhide release (iputils-20020927-4).

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.