Using the Ping Command
Applies To: Windows 7, Windows Server 2008 R2
The ping command helps to verify IP-level connectivity. When troubleshooting, you can use ping to send an ICMP echo request to a target host name or IP address. Use ping whenever you need to verify that a host computer can connect to the TCP/IP network and network resources. You can also use ping to isolate network hardware problems and incompatible configurations. Ping works with both Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6) addresses, but the examples in this topic show IPv4 only.
Follow this sequence to diagnose network connectivity:
Ping the loopback address to verify that TCP/IP is configured correctly on the local computer.
Ping the IP address of the local computer to verify that it was added to the network correctly.
Ping the IP address of the default gateway to verify that the default gateway is functioning and that you can communicate with a local host on the local network.
Ping the IP address of a remote host to verify that you can communicate through a router.
The following table shows some useful ping command options.
Determines the number of echo requests to send. The default is 4 requests.
Enables you to adjust the timeout (in milliseconds). The default is 1,000 (a 1-second timeout).
Enables you to adjust the size of the ping packet. The default size is 32 bytes.
Sets the Do Not Fragment bit on the ping packet. By default, the ping packet allows fragmentation.
Provides command Help.
The following example illustrates how to send two pings, each 1,450 bytes in size, to IP address 188.8.131.52:
C:\>ping -n 2 -l 1450 184.108.40.206 Pinging 220.127.116.11 with 1450 bytes of data: Reply from 18.104.22.168: bytes=1450 time<10ms TTL=32 Reply from 22.214.171.124: bytes=1450 time<10ms TTL=32 Ping statistics for 126.96.36.199: 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 might take longer to be returned. You can use the -w (wait) option to specify a longer timeout.
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.
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:
The ping command is blocked at the corporate or personal firewall level.
Configure the firewall to allow ICMP Echo and Echo Reply packets.
A router is down.
To check the routers in the path between the source and the destination, use 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 timeout. For example, to allow responses within 5 seconds, use
ping -w 5000.
The ping command uses Windows Sockets-style name resolution to resolve a computer name to an IP address, so if pinging by address succeeds, but pinging by name fails, then the problem lies in address or name resolution, not network connectivity.