ping - Network Connectivity Check
Table of Contents
The ping command is a basic network diagnostic command that sends ICMP Echo Request packets and checks whether Echo Reply packets come back.
It is often the first step for telling apart “Can I connect?”, “How long does a response take?”, and “Is host name resolution working?”.
Quick Reference: Copy-Paste ping Commands
| Goal | Command |
|---|---|
| Check connectivity (4 requests) | ping example.com |
| Set the number of requests (10) | ping /n 10 example.com |
| Keep pinging until stopped (Ctrl+C) | ping /t 192.168.1.1 |
| Wait 1 second for each reply (default is 4 seconds) | ping /w 1000 192.168.1.1 |
| Force IPv4 | ping /4 example.com |
| Look up the host name of an IP address | ping /a 192.168.1.10 |
| Check your PC’s own network stack | ping 127.0.0.1 |
Paste your ping result to check it
If you are not sure how to read the result, paste what Command Prompt shows as is. The tool judges the state from the replies and loss rate, and shows possible causes and commands to try next.
Paste the ping output from Command Prompt as is to see what it means and what to try next.
The check runs on this page. What you paste is not sent anywhere.
Paste a ping result and the verdict appears here.
Basic syntax of the ping command
ping <destination IP address or hostname>
ping [/t] [/a] [/n <count>] [/l <size>] [/f] [/i <TTL>] [/v <TOS>] [/r <count>] [/s <count>] [{/j <hostlist> | /k <hostlist>}] [/w <timeout>] [/R] [/S <Srcaddr>] [/4] [/6] <destination>
Basic usage
ping www.google.com
This result shows that name resolution succeeded and that ICMP replies were returned by the destination.
Commonly used options
| Option | Description |
|---|---|
/n <count> | Number of requests to send. The default is 4 |
/t | Keep sending until you stop it |
/w <ms> | Time to wait for each reply, in milliseconds. The default is 4000 (4 seconds) |
/a | Try to resolve the host name from the IP address |
/4 | Use IPv4 |
/6 | Use IPv6 |
/l <size> | Specify the data size in bytes. The default is 32, the maximum is 65500 |
/i <TTL> | Set the TTL (the maximum number of routers the packet can pass through) |
Send only 10 requests
ping /n 10 example.com
Keep sending until stopped
ping /t 192.168.1.1
Press Ctrl + C to stop. Press Ctrl + Break to display the statistics so far while it keeps sending.
Shorten the timeout
ping /w 1000 192.168.1.1
If no reply arrives within one second, the request is treated as timed out.
How to read the results of ping
Start by using the message to narrow down where it fails.
| Message | Meaning | Check first |
|---|---|---|
Reply from ...: bytes=32 time=15ms TTL=119 | The destination replied (working) | Response time and loss rate |
Request timed out. | No reply within the wait time | Whether the destination accepts ping |
Destination host unreachable. | No way to deliver to the destination was found | Your IP address and default gateway |
Destination net unreachable. | A router has no route to the destination network | Router settings and VPN connection |
Ping request could not find host ... | The host name could not be converted to an IP address | Spelling of the host name and DNS |
General failure. | Your PC could not send the packet | Network connection and security software |
TTL expired in transit. | The hop limit was reached at a router on the way | A routing loop (check with tracert) |
When replies come back
- The destination is reachable
- ICMP is not blocked by the destination or along the route
- You can see a rough response time
When Request timed out. is displayed
A timeout does not necessarily mean the destination is down.
It can also occur for reasons such as:
- The destination or a firewall along the route blocks ICMP
- Packets are being dropped along the route
- The destination is too busy to respond
- The specified timeout value is too short
When Destination host unreachable. is displayed
There may be a problem with your own network settings (IP address or default gateway) or with the route to the destination. This message is an error returned by your own computer or by an intermediate router, not a reply from the destination. Windows counts these lines as “Received” in its statistics, so even 0% loss there does not mean the destination was reached.
When it fails with a host name but succeeds with an IP address
In this case, the cause is likely DNS or name resolution rather than the network itself.
When Ping request could not find host ... is displayed
Name resolution (DNS), which converts the host name to an IP address, failed. Nothing was sent to the destination yet, so first check the spelling of the host name and use nslookup to see whether DNS returns an IP address. For an internal host name, also check that you are connected to the VPN.
When General failure. is displayed
PING: transmit failed. General failure. means your PC could not send the packet. Check that Wi-Fi or the cable is connected, that the network adapter is not disabled, and that security software is not blocking traffic. If sending over IPv6 fails, adding /4 to send over IPv4 may work.
When TTL expired in transit. is displayed
The packet reached its hop limit (TTL) before arriving at the destination. This is often caused by a router misconfiguration that makes packets loop between the same routers (a routing loop). Use tracert to check whether the same routers appear repeatedly.
A successful ping does not guarantee that web services or database connections are healthy. It only checks whether the destination is reachable at the ICMP level.
Practical uses
Check whether you can reach the default gateway
ping 192.168.1.1
This is the basic way to check whether the problem is on the local network side.
Check host name resolution
ping /a 8.8.8.8
ping example.com
The former checks reverse lookup, and the latter checks forward lookup.
Check in this order: your own computer (ping 127.0.0.1), the default gateway, an internal server, an external IP address (such as 8.8.8.8), and an external host name. The first place where it fails is a hint to where the cause is.
Check reachability in a batch file
When judging a ping result in a batch file, do not rely on the exit code alone. It can be 0 even when a router replies with “Destination host unreachable”. Using find to look for a line containing TTL= in the output detects only genuine replies from the target over IPv4 (IPv6 replies may not show TTL).
@echo off
ping /n 1 192.168.1.1 | find "TTL=" >nul
if %errorlevel%==0 (
echo Got a reply.
) else (
echo No reply.
)