How To Use The Ping Command
Using the ping command. Ping stands for Packet Internet Groper and is used to send a message from one computer to another to check whether it is reachable and active. By default, Ping sends four ICMP packets and awaits for the machine to respond, responses usually happen in one second intervals. This default setting can however be changed and the number of packets sent and the await time for responses can be changed through the different parameters available for Ping. As well as verifying the availability of remote machine, Ping can help with issues relating to name resolution. To use Ping, launch a command prompt with administrative priviledges and enter Ping Targetname. Several different parameters are available to be used with Ping. To view all the accepted parameters enter Ping /? or Ping (with no parameters). Acceptable parameters for use with the Ping command are as follows:
- -4 : Specifies that IPv4 should be used to ping, this is not required for identifying the target machine with a IPv4 address but it will be required only to identify the target machine by name.
- -6 : Specifies that IPv6 should be used to ping, similar to –4 this is not required for identifying the target machine with an IPv6 address but it will be required only to identify the target machine by name.
- -a : Resolves the IP address to the hostname which is displayed if this command is successful.
- -f : Requests that the echo back messages are sent with a Don’t Fragment flag in packets (only available in IPv4).
- -i ttl : Increases the timeout when using slow connections, also sets the value of TTL (Time to Live) the max value for this is 255.
- -j HostList : Routes the packets using the host list (this is a listing of IP addresses which are separated by spaces), hosts can be separated by intermediate gateways (ie loose source route).
- -k HostList : Similar to –j but the hosts can’t be separated by intermediate gateways (ie strict source route).
- -l size : Specifies the length (in bytes) of the packets – default is 32 and the max is 65,527.
- -n count : Specifies the number of packets which are sent – default is 4.
- -r count : Specifies the route for the outgoing and the incoming packets, you can specify a count which is equal to or higher than the number of hops between source and destination. The count must be between 1 to 9.
- -R : Specifies that the round-trip path should be traced (this is only available on IPv6).
- -s count : Sets a time stamp for the number of hops specified by count, this count needs to be between 1 and 4.
- -S SrcAddr : Sets the source address (this is only available on IPv6).
- -t : Specifies that Ping should continue sending packets to the destination until interrupted. To stop and display statistics, press Ctrl+Break. To stop and quit PING, press Ctrl+C.
- -v TOS : Sets the value of the type of service in the packet sent (default for this setting is zero). TOS is specified by a decimal between 0 and 255.
- -w timeout : Sets the time in milliseconds for the packet timeout. If the reply isn’t received before a timeout, the Request Timed Out error message will be shown. The default timeout is four seconds.
- .TargetName : Sets the hostname or IP address of the destination to ping.
Sometimes remote hosts will be configured to ignore all icmp requests for security reasons. Therefore, the inability to ping a server may not always mean the server is not working. For example I could send continuos 128bit packets to a remote machine and flood the network.