Share via


Ping

Ping is the primary tool for troubleshooting IP-level connectivity. Type ping -? at a command prompt to see a complete list of available command-line options. Ping allows you to specify the size of packets to use (the default is 32 bytes), how many to send, whether to record the route used, what Time To Live (TTL) value to use, and whether to set the "don't fragment" flag.

When a ping command is issued, the utility sends an ICMP Echo Request to a destination IP address. Try pinging the IP address of the target host to see if it responds. If that succeeds, try pinging the target host using a host name. Ping first attempts to resolve the name to an address through a DNS server, then a WINS server (if one is configured), then attempts a local broadcast. When using DNS for name resolution, if the name entered is not a fully qualified domain name, the DNS name resolver appends the computer's domain name or names to generate a fully qualified domain name.

If pinging by address succeeds but pinging by name fails, the problem usually lies in name resolution, not network connectivity. Note that name resolution might fail if you do not use a fully qualified domain name for a remote name. These requests fail because the DNS name resolver is appending the local domain suffixes to a name that resides elsewhere in the domain hierarchy.

The following example illustrates how to send two pings, each 1450 bytes in size, to address 172.16.99.2:

C:\>ping -n 2 -l 1450 172.16.99.2

Pinging 172.16.99.2 with 1450 bytes of data:

Reply from 172.16.99.2: bytes=1450 time<10ms TTL=62

Reply from 172.16.99.2: bytes=1450 time<10ms TTL=62

Ping statistics for 172.16.99.2:

Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

By default, Ping waits one second for each response to be returned before timing out. If the remote system being pinged is across a high-delay link such as a satellite link, responses might take longer to be returned. Use the -w (wait) switch to specify a longer time-out.

note-iconNote

If Ping indicates a high packet loss or slow round-trip response on a LAN, your network might have a hardware problem. On a WAN, these results may be normal, and TCP/IP is designed to handle the variability. On a LAN, round-trip time is very low, and you see little or no packet loss. If this isn't the case, test your cables, cable terminations, hubs, switches, and transceivers.

Table 3.10 lists Ping switches.

Table 3.10 Ping Switches

Switch

Function

-t

Pings the specified host until stopped. To see statistics and continue type Control-Break. To stop type Control-C.

-a

Resolves addresses to host names.

-n < count >

Sets number of echo requests to send.

-l < size >

Sends packets of a particular size.

-f

Sets the "Don't Fragment" flag in outgoing packets.

-i < TTL >

Specifies a Time To Live for outgoing packets.

-v < TOS >

Specifies type of service.

-r < count >

Records the 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.

-w

Sets a long wait periods (in milliseconds) for a response.