The Ping command is used to test the connection speed to other network nodes. You can use it to tell you the strength, distance, and availability of your connection, both on your own network and on the internet. Follow this guide to use the Ping command on any system.
Step
Method 1 of 4: Ping on Windows, Mac OS X, and Linux
Step 1. Open Command Prompt or Terminal
Every operating system has a command line interface for executing Ping commands. The Ping command is visually nearly identical on all systems.
- If using Windows, open Command Prompt. Click the Start button and enter cmd into the Search field. Windows 8 users can temporarily type "cmd" on the Start screen. Press Enter to start the Command Prompt.
- If using Mac OS X, open Terminal. Open the Applications folder, then the Utilities folder. Select Terminals.
-
If using Linux, open a Telnet/Terminal window. This application is most often found in the Accessories folder or in the application directory.
On Ubuntu, you can use the shortcut Ctrl+Alt+T to open a terminal
Step 2. Enter the Ping command
Type ping hostname or ping IP address.
- The hostname is usually the website address. Replace the hostname with the website or server you want to test. For example, to test wikiHow's main web server, type ping www.wikihow.com.
- An IP address is a computer's location on a network, either on a local network or on the internet. If you know the IP address you want to test, replace the IP address with it. For example, to test for the IP address 192.168.1.1, type ping 192.168.1.1.
- To test your own PC, type ping 127.0.0.1.
Step 3. Press Enter to see the ping output
The result will be shown below the current command line. See below for how to read the output.
Method 2 of 4: Testing with Network Utility on Mac OS X
Step 1. Open Network Utility
Open the Applications folder and select Utilities. Look for Network Utility.
Step 2. Click the Ping tab
Specify a host name or IP address.
- The hostname is usually the website address. Replace the hostname with the website or server you want to test. For example, to test wikiHow's main web server, type ping www.wikihow.com.
- An IP address is a computer's location on a network, either on a local network or on the internet. For example, to test for the IP address 192.168.1.1, type ping 192.168.1.1.
Step 3. Set the number of pings you want to send
Good measurements are usually obtained with only 4-6 pings. Click Ping when you are ready. The output will be displayed at the bottom of the window.
Method 3 of 4: Reading Ping Output
Step 1. Read the first line
The first line tells the command what to do. This line repeats the address you entered and tells how much data is being sent. As an example:
Step 2. Read the output content
The Ping command if successful will produce a line that displays how long the address took to respond. TTL indicates the number of jumps that occurred during the packet transfer process. The lower the number, the more routers the packet passes through. Time is how long the connection lasts in milliseconds:
Reply from 173.203.142.5: bytes=32 time=102ms TTL=48
Reply from 173.203.142.5: bytes=32 time=105ms TTL=48
Reply from 173.203.142.5: bytes=32 time=105ms TTL=48
Reply from 173.203.142.5: bytes=32 time=108ms TTL=48
You can press Ctrl+C to stop the ping
Step 3. Read the summary
A summary of the results will appear after the operation is complete. Lost packets (Lost) means that your connection to the destination address is unreliable, and data is lost during transfer. This summary also shows the average connection time:
Ping statistics for 173.203.142.5:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 102ms, Maximum = 108ms, Average = 105ms
Method 4 of 4: Troubleshooting Ping Command Failed
Step 1. Check your typing
One of the most common error reports is:
This means that you have misspelled the hostname.
- Try retyping to fix it. If the problem persists, repeat with a well-known hostname, such as a search engine or news site. If the result is “Unknown host,” the problem is most likely with the address of the domain name server.
- Test using the host's IP address instead of the name (eg 173.203.142.5). If this is successful then the address on the domain name server is incorrect or inaccessible or is down.
Step 2. Check your connection
Other error messages are:
sendto: No route to host
This means the gateway address is incorrect or the connection from your PC is not working.
- Ping 127.0.0.1: this is your own PC. If this fails, TCP/IP is not functioning properly, and the network adapter must be reconfigured.
- Check the wireless connection or the connection from the PC to the router, especially if the connection was previously working.
- Most PC network ports have an indicator light indicating a good connection, and another flashing light indicating data is being transferred. When the ping command sends packets at about 1 per second, you will see the data light flash.
- Check that the router has the proper light indicators (and no errors), including an indicator indicating a good connection to your PC. If the error indicator is on, follow the cable from the PC to the router to make sure it is properly connected, or contact the cable or broadband provider if necessary.
Tips
-
The options available depend on the command. Here are some of the available options:
- -c Total. Sends the number of packets then stops. Another way to stop the ping is to type [ctrl]-C. This option is convenient for scripts that periodically check network behavior.
- -t Ping until it stops ([ctrl]-C).
- -w Time out. Waits for a response before the message timeouts or disappears, in milliseconds. Pings with longer timeouts may indicate latency issues. ping -w 10000. this usually only helps on operations over cellular, satellite or other high latency networks.
- -n Numeric output only. Use this to avoid contacting the "nameserver".
- -p Pattern. The pattern is a string of hexadecimal digits to record the end of the packet. This is rarely useful if you suspect the problem is with the data.
- -R Use the Record IP Route option to specify what route the ping packets use. The destination host may not provide this information.
- -r Passes the routing table. Use this when you suspect a routing problem and ping cannot find a route to the destination host. This only works for hosts that can be directly reached without using a router.
- -s Packet size. Change the package size. Checks for very large packets that must be fragmented.
- -V Detailed output (verbose). Features additional ICMP packages that provide very detailed information.
- -f Flood (flood). Send the package as soon as possible. It is used to emphasize network performance testing and should be avoided.
- -l Preload. Sends preloaded packets as fast as possible, then enters normal behavior mode. Good for figuring out how many packets the router is capable of handling, in turn good for diagnosing problems that only arise with large TCP window sizes.
- -? Help. Use this option to see a complete list of options and syntax for using Ping.
- Why should I use ping? Ping (named after the submarine's echo location) uses the simplest packet type. This response is carried out by the communications subsystem (TCP/IP) portion of the Operating System. Ping does not need any application, accesses no files, requires no configuration and has almost no impact on other activities. Ping does not require all hardware, gateways, routers, firewalls, server names and intermediate servers to work. If the ping is successful but you are unable to access the destination host with a browser or other application, the problem is most likely not with you.
- When is it time to use ping? As with all diagnostic tools, the best time to use ping is when the network configuration is working, so you understand how the configuration should work. You can test the PC yourself using "ping -c5 127.0.0.1". When first setting up the PC, change the network. If you can't surf the internet, use ping to validate equipment and configuration You.