fortypoundhead.com

PING

Posted On 2007-04-24 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 2777


Test a network connection - if successful, ping returns the ip address.

Syntax
PING [options] destination_host

Options
-w timeout Timeout in milliseconds to wait for each reply.
-i TTL Time To Live.
-v TOS Type Of Service.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-t Ping the destination host until interrupted.
-l size Send buffer size.
-f Set Don''t Fragment flag in packet.
-r count Record route for count hops.
-s count Timestamp for count hops.
-j host_list Loose source route along host_list.
-k host_list Strict source route along host_list.
destination_host The name of the remote hostA response of "Request timed out" means there was no response to the ping attempt in the default time period of one second.
If 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 five seconds, use ping -w 5000.

A successful PING does NOT always return an %errorlevel% == 0
Therefore to reliably detect a successful ping - pipe the output into FIND and look for the text "TTL"

Note that "Reply" in the output of PING does not always indicate a positive response. You may receive a message from a router such as: Reply from 192.168.1.254: Destination Net Unreachable.

Four steps to test an IP connection with ping:

1) Ping the loopback address to verify that TCP/IP is installed and configured correctly on the local computer.
PING 127.0.0.1

2) Ping the IP address of the local computer to verify that it was added to the network correctly.
PING IP_address_of_local_host

3) 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 IP_address_of_default_gateway

4) Ping the IP address of a remote host to verify that you can communicate through a router.
PING IP_address_of_remote_host

Examples

PING -n 1 -w 7500 Server_06

PING -w 7500 MyHost |find "TTL=" && ECHO MyHost found

PING -w 7500 MyHost |find "TTL=" || ECHO MyHost not found

PING -n 5 -w 7500 www.microsoft.com

PING -n 5 -w 7500 microsoft.comPING is named after the sound that a sonar makes.

Ping times below 10 milliseconds often have low accuracy.

A time of 10 milliseconds is roughly equal to a distance of 930 Miles, travelling a straight line route at the speed of light.


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.81.45.122

Before you can post, you need to prove you are human. If you log in, this test goes away.




Recent Forum Posts

Advanced search added
dwirch posted on September 23, 2017 at about 13:44 in Site News

Job Spammer: Gaurav Mehta - AgreeYa Solutions
dwirch posted on September 22, 2017 at about 10:35 in Spammers

Job Spammer: Prutha Siri - Javelin Systems
dwirch posted on September 10, 2017 at about 6:15 in Spammers

New security implemented
dwirch posted on September 7, 2017 at about 7:16 in Site News

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers