Share via


Using the ping command

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Using the ping command

If you are having connectivity problems, you can use the ping command to check the destination IP address you want to reach and record the results. The ping command displays whether the destination responded and how long it took to receive a reply. If there is an error in the delivery to the destination, the ping command displays an error message.

You can use the ping command to:

  • Ping your computer (by address, not host name) to determine that TCP/IP is functioning. (Pinging your computer does not verify that your network adapter is functioning.)

  • Ping the local router to determine whether the router is running.

  • Ping beyond your local router.

The following table shows some useful ping command options.

Option Use

-nCount

Determines the number of echo requests to send. The default is 4 requests.

-wTimeout

Enables you to adjust the time-out (in milliseconds). The default is 1,000 (a 1-second time-out).

-lSize

Enables you to adjust the size of the ping packet. The default size is 32 bytes.

-f

Sets the Do Not Fragment bit on the ping packet. By default, the ping packet allows fragmentation.

The following example illustrates how to send two pings, each 1,450 bytes in size, to IP address 131.107.8.1:

C:\>ping -n 2 -l 1450 131.107.8.1
Pinging 131.107.8.1 with 1450 bytes of data:

Reply from 131.107.8.1: bytes=1450 time<10ms TTL=32
Reply from 131.107.8.1: bytes=1450 time<10ms TTL=32

Ping statistics for 131.107.8.1:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate roundtrip times in milliseconds:
    Minimum = 0ms, Maximum =  10ms, Average =  2ms

By default, ping waits 4,000 milliseconds (4 seconds) for each response to be returned before displaying the "Request Timed Out" message. If the remote system being pinged is across a high-delay link, such as a satellite link, responses may take longer to be returned. You can use the -w (wait) option to specify a longer time-out.

For more information about other ping options, see Command-line utilities.

To check connectivity by using the ping command, at the command prompt, type ping and the IP address you want to reach.

A response of "Destination net unreachable" means there was no route to the destination. You need to check the routing table on the router listed in the "Reply from" address in the "Destination net unreachable" message. For more information about the routing table, see Understanding the IP routing table.

A response of "Request timed out" means that there was no response to the ping in the default time period (1 second). You can check for the following:

  • A router is down.

    To check the routers in the path between the source and the destination, use the tracert command. For more information, see Using the tracert command.

  • The destination host is down.

    Physically verify that the host is running or check connectivity through another protocol.

  • There is no route back to your computer.

    If the host is running, you can check for a return route by viewing the default gateway and local routing table on the destination host.

  • The latency of the response is more than one second.

    Use the -w option on the ping command to increase the time-out. For example, to allow responses within 5 seconds, use ping -w 5000.