Wednesday 7 November 2012

Linux for you Admin Tips: 11

speed up ping command response


[sankar@new-host ~]$ ping -c 5 google.com
PING google.com (74.125.233.4) 56(84) bytes of data.
64 bytes from cpt01s01-in-f4.1e100.net (74.125.233.4): icmp_req=1 ttl=53 time=49.5 ms
64 bytes from cpt01s01-in-f4.1e100.net (74.125.233.4): icmp_req=2 ttl=53 time=49.7 ms
64 bytes from cpt01s01-in-f4.1e100.net (74.125.233.4): icmp_req=3 ttl=53 time=51.7 ms
64 bytes from cpt01s01-in-f4.1e100.net (74.125.233.4): icmp_req=4 ttl=53 time=48.7 ms
64 bytes from cpt01s01-in-f4.1e100.net (74.125.233.4): icmp_req=5 ttl=53 time=49.8 ms
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 48.745/49.924/51.715/1.008 ms
[sankar@new-host ~]$ ping -c 5 -n -i 0.2 -W1 google.com
PING google.com (74.125.233.3) 56(84) bytes of data.
64 bytes from 74.125.233.3: icmp_req=1 ttl=52 time=50.5 ms
64 bytes from 74.125.233.3: icmp_req=2 ttl=52 time=51.7 ms
64 bytes from 74.125.233.3: icmp_req=3 ttl=52 time=48.7 ms
64 bytes from 74.125.233.3: icmp_req=4 ttl=52 time=51.8 ms
64 bytes from 74.125.233.3: icmp_req=5 ttl=52 time=50.6 ms
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 803ms
rtt min/avg/max/mdev = 48.766/50.706/51.827/1.110 ms
ping -n -W VALUE -i VALUE host  
Where,
  1. -n : Disable DNS lookup to speed up queries.
  2. -W NUMBER : Time to wait for a response, in seconds. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.
  3. -i SECONDS : Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 seconds.

No comments:

Post a Comment