• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Ping \windows\system32\ping.exe

Test the “reachability” of another computer on the network or across the Internet.

To Open

Command Prompt ping

Usage

ping target [-t] [-a] [-n count] [-l size] [-f] [-w timeout]
   [-r count] [-s count] [-j host_list | -k host_list]
   [-i ttl] [-v tos]

Description

The primary function of Ping is to see if another computer is “alive” and reachable. Ping works on local networks and across Internet connections. For example, type the following at a command prompt:

ping oreilly.com

and you’ll get a report that looks something like this:

Pinging oreilly.com [209.204.146.22] with 32 bytes of data:
Reply from 209.204.146.22: bytes=32 time=78ms TTL=238
Reply from 209.204.146.22: bytes=32 time=31ms TTL=238
Reply from 209.204.146.22: bytes=32 time=15ms TTL=238
Reply from 209.204.146.22: bytes=32 time=78ms TTL=238
Ping statistics for 209.204.146.22:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 15ms, Maximum =  78ms, Average =  50ms

Here, Ping sent out four pings (the default), reported the time it took for them to return (in milliseconds), and then displayed various statistics about the session. Ping is especially useful if you’re having trouble contacting a server and you want to see if the server is alive (running and accepting connections). If the server does not reply (meaning that it is down or the connection has been severed), you’ll see Request timed out. Ping accepts the following options:


target

The machine to ping; it can be the name of a computer on your network, an IP address (e.g., 209.204.146.22), or an Internet address (e.g., http://oreilly.com).


-t

Normally, Ping sends out four pings and then quits. Include the -t option to ping continually until Ping is interrupted by pressing Ctrl-C. Press Ctrl-Break to display statistics without interrupting.


-a

Resolve addresses to hostnames.


-n count

The number of pings to send; the default is four.


-l size

The size of the packets to send, in bytes; the default is 32 bytes.


-f

Turn on the “Don’t Fragment” flag in packet.


-w timeout

The amount of time to wait, in milliseconds, before Ping gives up and displays Request timed out; the default is 500 milliseconds (1/2 second).


-r count

Display the route taken to reach the server (see “Tracert”, later in this chapter). The count is the maximum number of hops to record, and can range from 1 to 9.


-s count

Display a time stamp for count hops.


-j host_list

Impose a “loose” route (see the -r option) along which to ping.


-k host-list

Impose a “strict” route (see the -r option) along which to ping.


-i ttl

Specify the Time To Live (TTL); valid range is from 0 to 255.


-v tos

Specify the Type of Service (TOS); valid range is from 0 to 255.

Notes

The name “ping” comes from submarine lingo, when sonar was used to detect nearby objects, such as ships and other submarines. Pulses of sound were sent through the water; those that returned indicated the existence of an object off which the pulses were reflected. ping.exe works very similarly, except it sends packets instead of sonic pulses.

See Also

“Tracert”, “NSLookup”

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint