ping

Use the ping command, which requests ICMP echo replies from a specified host or network device, to test if a host or other device is active and reachable. Anyone can issue the ping command.

Command Syntax

Syntax

ping {hostname|ip_addr} [continuous] [verbose] [record_route] [fill=char] [intv=msec] [npkts=num] [pksiz=bytes] [loose_sroute=ip_addr,ip_addr...] [strict_sroute=ip_addr,ip_addr...]

Command Fields

Command Field

Description

hostname | ip_addr  

Identifies the target device of the ping (ICMP echo request). Use one of the following to identify this device:

  • A domain name
  • An IP address

continuous

Specifies that pings be sent continuously until stopped.

Press the interrupt keys to stop continuous pings. The default interrupt keys are <Ctrl-C>.

verbose

Specifies that the ping must pass through the routers indicated—and only those indicated—on its way to the target host. These routers are identified by their IP addresses.

record_route

Specifies that each router through which the ping passes record its IP addresses for inclusion in the echo reply.

fill

Specifies characters to include in the data portion of the echo reply.

intv

Specifies the interval in milliseconds between pings.

The range is -1 to 60000, and the default is 1000 milliseconds (one second). -1 means that echoes will be continuously sent until the value in the npkts field is reached.

npkts

Specifies the number of packets to include with each ping.

The range is 1 to 30000; the default is 1.

pksiz

Specifies the size of a packet, in bytes.

The range is 0 to 20000; the default is 56.

loose_sroute

Specifies that the ping must pass through the routers indicated on its way to the target host. These routers are identified by their IP addresses.

strict_sroute

Specifies that returned echo replies include statistics associated with the ping, such as the roundtrip time and the number of packets transmitted and received.

Command Examples

Ping with No fields

In this example, the ping command simply determines whether the specified host can be reached.

ping 199.150.150.10

Loose Source Routing

In this example, the ping command specifies loose source routing, which means that the ping must pass through the routers identified on the loose_sroute parameter. The ping may, however, pass through additional routers as well.

ping 199.150.150.10 loose_sroute=199.150.160.10,190.150.161.10

Strict Source Routing

In this example, the ping command specifies strict source routing, which means that the ping must pass through the routers identified on the strict sroute field, and only those routers. If it cannot reach the destination along this path, the destination is regarded as unreachable.

ping 199.150.150.10 strict_sroute=199.150.160.10,190.150.161.10