Yeah, I tend to agree with you. In fact, for the most part, your are
indeed correct. But the rate can still be effected...
ping only does a lookup on the hostname in order to be able to send the
ping, at the start, when the command is invoked.
However, it does a lookup on every REPLY it receives. i.e. when it gets
the reply to a ping it has sent it, say it comes back from 194.125.2.240,
it does a lookup on that address before it displays it to you. This is why
you see hostname (ipaddress) in the output.
Its quite easy to demonstrate this. Below I start a ping to ns.iol.ie,
while the ping is still running, I block[1] outbound requests on port 53
(i.e. stop it from doing DNS lookups). Watch what happens...
64 bytes from ns.iol.ie (194.125.2.240): icmp_seq=9 ttl=247 time=21.9 ms
64 bytes from ns.iol.ie (194.125.2.240): icmp_seq=10 ttl=247 time=20.8 ms
64 bytes from ns.iol.ie (194.125.2.240): icmp_seq=11 ttl=247 time=15.7 ms
64 bytes from 194.125.2.240: icmp_seq=12 ttl=247 time=27.2 ms
64 bytes from 194.125.2.240: icmp_seq=13 ttl=247 time=15.7 ms
64 bytes from 194.125.2.240: icmp_seq=14 ttl=247 time=15.4 ms
So as we can see, it does do DNS lookups in real time on the reply
address. But not, as you pointed out, on the destination host at each
ping.
- Ronan
[1] Keeping the auld iptables thing going, here is the rule I used...
# iptables -A OUTPUT -o eth0 -p udp -m udp --dport 53 -j DROP
On Wed, 22 Oct 2003, David Dorgan wrote:
>> This is a pretty strange situation, the rate should only
> effect it on startup, gethostbyname isn't called for
> every ping sent out.
>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!