|
Connected: An Internet Encyclopedia Wednesday 7 January 2009 12:53:00 1231332780 |
|
Ping
Up:
Connected: An Internet Encyclopedia
Ping
``Ping'' is one of the most useful network debugging tools available. It takes its name from a submarine sonar search - you send a short sound burst and listen for an echo - a ping - coming back. In an IP network, `ping' sends a short data burst - a single packet - and listens for a single packet in reply. Since this tests the most basic function of an IP network (delivery of single packet), it's easy to see how you can learn a lot from some `pings'. Ping is implemented using the required ICMP Echo function, documented in RFC 792 that all hosts should implement. Of course, administrators can disable ping messages (this is rarely a good idea, unless security considerations dictate that the host should be unreachable anyway), and some implementations have (gasp) even been known not to implement all required functions. However, ping is usually a better bet than almost any other network software. Many versions of ping are available. For the remainder of this discussion, I assume use of BSD UNIX's ping, a freely available, full-featured ping available for many UNIX systems. Most PC-based pings do not have the advanced features I describe. As always, read the manual for whatever version you use.
What Ping can tell you
What Ping can not tell you
Using pingPing should be your first stop for network troubleshooting. Having problems transferring a file with FTP? Don't fire up your packet analyzer just yet. Leave your TDR in the box for now. Relax. Put on some Yanni. Don't even ``su'' - ping is a non-privileged command on most systems. Start one running and just watch it for at least two minutes. That's enough time for most periodic network problems to show themselves. Once you've seen about a hundred packets, you should be getting a good feel for how this host is responding. Are the round-trip times consistent? Seeing any packet loss? Are the TTL values sane? Start pinging other hosts. Try the machine next to you - the problem might be closer than you think. Try the last router - maybe the remote system is overloaded (especially if it's a popular Internet site like this one). Don't know what the last router is? Use traceroute or guess - changing the last number in the IP address to 1 usually gets you something interesting. Check other sites with similar network topologies (other remote LAN sites, or other Internet sites, or other sites using the same backbone). Starting to learn something about how your network is responding? Good. And - oh, yeah, go check that FTP. It's probably done by now. Here's a list of common BSD ping options, and when you might want to use them:
Sample ping sessionsThis ping session shows a ten packet exchange over the loopback interface. One line is printed for every reply received. Note that for each sequence number, a single reply is received, and they are all in order. The IP TTL values are reported, as are the round-trip times. Both are very consistent. At the end of the session, statistics are reported. Pinging the loopback interface is a good way to test a machine's basic network configuration, since no packets are physically transmitted. Any problems in such a test is cause for alarm. meikro$ ping -c10 localhost PING localhost (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=5 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=6 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=7 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=8 ttl=255 time=2 ms 64 bytes from 127.0.0.1: icmp_seq=9 ttl=255 time=2 ms --- localhost ping statistics --- 10 packets transmitted, 10 packets received, 0% packet loss round-trip min/avg/max = 2/2/2 ms meikro$ The next session shows a more interesting example - a router on the remote side of a medium speed (128Kbps) link. The initial timings show consistent link behavior. However, about 50 seconds into the trace, we see greater fluctuations in the RTT, which approaches one minute for several packets. From packet 53 to 54, we see a factor of 26 reduction in RTT. But since reductions in RTT rarely cause problems, this is not as troublesome as the change from packet 54 to 55, a factor of 7 increase in RTT. So what should the RTT be? Well, we're transferring 56 data bytes, plus an 8 byte ICMP header (64 ICMP bytes), plus a 20 byte IP header - 84 byte packets. At 128 kilobits per second, 84 bytes should require about 84*(8/128000) = 6 ms to transfer. Since the packet has to go both ways, we expect 10-15 ms round-trip times. None of these values are that low; clearly there are problems with this link. More than anything else, it is simply overcrowded. access 9 >ping sl-stk-3-S17-128k.sprintlink.net PING sl-stk-3-S17-128k.sprintlink.net (144.228.202.1): 56 data bytes 64 bytes from 144.228.202.1: icmp_seq=0 ttl=254 time=35.653 ms 64 bytes from 144.228.202.1: icmp_seq=1 ttl=254 time=28.797 ms 64 bytes from 144.228.202.1: icmp_seq=2 ttl=254 time=28.559 ms 64 bytes from 144.228.202.1: icmp_seq=3 ttl=254 time=39.533 ms 64 bytes from 144.228.202.1: icmp_seq=4 ttl=254 time=28.621 ms 64 bytes from 144.228.202.1: icmp_seq=5 ttl=254 time=28.159 ms ... 64 bytes from 144.228.202.1: icmp_seq=50 ttl=254 time=848.810 ms 64 bytes from 144.228.202.1: icmp_seq=51 ttl=254 time=828.579 ms 64 bytes from 144.228.202.1: icmp_seq=52 ttl=254 time=753.865 ms 64 bytes from 144.228.202.1: icmp_seq=53 ttl=254 time=778.202 ms 64 bytes from 144.228.202.1: icmp_seq=54 ttl=254 time=29.913 ms 64 bytes from 144.228.202.1: icmp_seq=55 ttl=254 time=220.931 ms 64 bytes from 144.228.202.1: icmp_seq=56 ttl=254 time=173.661 ms 64 bytes from 144.228.202.1: icmp_seq=57 ttl=254 time=144.990 ms 64 bytes from 144.228.202.1: icmp_seq=58 ttl=254 time=28.520 ms ... access 10 >
What you might see
Next: TCPdump
Connected: An Internet Encyclopedia
|
| Associate sites: Cheap domain names registration, Buy domain name and domain register, web hosting service or domain hosting |
|
This site is sponsored by the courtesy of Active-Domain.com |
| If we could read the secret history of our enemies, we should find in each man's life sorrow and suffering enough to disarm any hostility. |