Generally, traceroute is a much more useful tool for troubleshooting network problems. Here's what ping is useful for:
Always ping to an IP address, not a domain name, to avoid seeing problems related to DNS.
You can do a basic ping from any of our routers or hosts. Here's a basic "are you alive?" ping to gw0-sf-tlg (140.174.125.5) from fairy....
_fairy.tlg.net[/usr/local/etc/namedb]> ping 140.174.125.5 PING 140.174.125.5 (140.174.125.5): 56 data bytes 64 bytes from 140.174.125.5: icmp_seq=0 ttl=253 time=49.167 ms 64 bytes from 140.174.125.5: icmp_seq=1 ttl=253 time=13.255 ms 64 bytes from 140.174.125.5: icmp_seq=2 ttl=253 time=5.292 ms 64 bytes from 140.174.125.5: icmp_seq=3 ttl=253 time=7.831 ms ^C --- 140.174.125.5 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 5.292/18.886/49.167 ms
"ctrl-C" (^C) stops the ping.
Here's a basic ping from gw0-sf-tlg to gw2-mv:
Notice that since this uses a hostname, not an IP address, ping has to translate gw2-mv to an IP address before it does the ping; it contacts our domain name server (fnord.tlg.net) at 140.174.153.100 to do this. If the name server is down, the ping will "hang" unless you use the IP address.
gw0-sf-tlg>ping gw2-mv Translating "gw2-mv"...domain server (140.174.153.100) [OK] Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 140.174.31.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/12 ms
You can only do a ping -c from fairy unless you have root access to a Cisco router. On Ciscos and Livingstons, you can only do 5 pings by default.
The "-c" option for ping allows you to specify a certain number of pings to the target. This way, you can get a more accurate idea of what kind of packet loss is occuring on the link.
To really track down packet loss or slowness between points, you need to test every hop in between to see which link is dropping the packets. Traceroute will give you a list of all the hops you need to check.
Important things to note:
An example of ping -c: here's a ping to a customer site from the MS NOC:
>ping -c 10 140.174.99.6 PING 140.174.99.6 (140.174.87.6): 56 data bytes 64 bytes from 140.174.99.6: icmp_seq=0 ttl=253 time=16.124 ms 64 bytes from 140.174.99.6: icmp_seq=1 ttl=253 time=38.595 ms 64 bytes from 140.174.99.6: icmp_seq=2 ttl=253 time=78.158 ms 64 bytes from 140.174.99.6: icmp_seq=3 ttl=253 time=15.999 ms 64 bytes from 140.174.99.6: icmp_seq=4 ttl=253 time=26.761 ms 64 bytes from 140.174.99.6: icmp_seq=5 ttl=253 time=46.952 ms 64 bytes from 140.174.99.6: icmp_seq=6 ttl=253 time=28.869 ms 64 bytes from 140.174.99.6: icmp_seq=7 ttl=253 time=62.654 ms 64 bytes from 140.174.99.6: icmp_seq=8 ttl=253 time=27.076 ms 64 bytes from 140.174.99.6: icmp_seq=9 ttl=253 time=22.660 ms --- 140.174.99.6 ping statistics --- 10 packets transmitted, 10 packets received, 0% packet loss round-trip min/avg/max = 15.999/36.380/78.158 ms