Compartilhar via


Ping (Compact 2013)

3/26/2014

The ping command-line tool verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) echo request messages. The ping command-line tool displays the receipt of corresponding echo reply messages, along with echo request/response round-trip times. It is the primary TCP/IP command that you use to troubleshoot connectivity, reachability, and name resolution. By default, ping sends both ICMP and ICMPv6 echo request messages. It also displays help when you use it without options.

Syntax

ping [-t] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [-w timeout] [-S srcaddr] [-d] [-4 | -6] destination

Options

The following table describes each ping option. These options are not case-sensitive.

Option

Option

Description

-t

Sends echo requests to the specified destination until you stop the ping command-line tool. To stop the ping command-line tool, press CTRL+C.

-n

count

Sends the number of ICMP echo request messages specified by count. The default is 4.

-l

size

Specifies the length, in bytes, of the Data field in the echo request message. The size option specifies the number of bytes. The default is 32 bytes, and the maximum is 65,527 bytes.

-f

Specifies that ICMP echo request messages are sent with the Don’t Fragment flag in the IP packet header set to 1 (IPv4 only). When this flag is set, the echo request message cannot be fragmented by routers in the path to the destination. This option is useful for troubleshooting Path Maximum Transmission Unit (PMTU) problems.

-i

TTL

Specifies the Time to Live value. This value is the maximum number of routers an IP packet may pass through before being discarded. The default is 32 routers.

-v

TOS

Specifies the Type Of Service value (IPv4-only). The default is 0 (zero). For more about the TOS field in IPv4 packet headers, see RFC 1349.

-r

count

Specifies that the Record Route option in the IP header is used to record the path taken by the echo request message and corresponding echo reply message (IPv4 only). Each hop in the path uses an entry in the Record Route option. The count option specifies the number of hops. If possible, specify a count value that is equal to or greater than the number of hops between the source and the destination.

-s

count

Specifies that the Internet Timestamp option in the IP header is used to record the time of arrival for the echo request message and corresponding echo reply message for each hop (IPv4 only). The count option specifies the number of hops.

-w

timeout

Specifies the amount of time, in milliseconds, to wait for the echo reply message that corresponds to a given echo request message. If the echo reply message is not received within the time-out, ping displays the "Request timed out" error message. The default time-out value is 4000 (4 seconds).

-S

srcaddr

Specifies the source address to use (IPv6 only).

-d

Prints output to the debug output port. If your device is connected to Platform Builder, ping prints to the Output window in Visual Studio.

-4

Specifies that IPv4 is used to ping the destination. This option is not necessary when you are identifying the destination with an IPv4 address; it is only necessary when you identify the target host by name.

-6

Specifies that IPv6 is used to ping the destination. This option is not required when you are identifying the destination with an IPv6 address; it is only necessary when you identify the target host by name.

destination

Specifies the host name or IP address of the destination.

Remarks

By default, ping queries both IPv4 and IPv6 addresses when you specify a host name for destination. You can override this behavior by using the -4 or -6 option.

Example

The following example shows typical output produced by the ping command-line tool.

\> ping 192.168.26.136
Pinging Host 192.168.26.136
Reply from 192.168.26.136: Echo size=32 time<1ms TTL=128
Reply from 192.168.26.136: Echo size=32 time<1ms TTL=128

See Also

Reference

Network Command-Line Tools Reference

Concepts

Network Command-Line Tools Catalog Items and Sysgen Variables