PING Command
Purpose
Use the PING command to send an echo request to a foreign node to determine if the node is accessible. PING uses ICMP as its underlying protocol.
Operands
- host_name
- Specifies the foreign host to which you want to send the echo request. If you omit the host_name, the system prompts you for a host name. The host name is either a character-string name or the internet address in the standard format of the foreign host (dotted-decimal format for IPv4 addresses, and either full or compressed format for IPv6 addresses).
- Help
- ?
- Provides help information about the PING command. You cannot place the HELP parameter on the PING command line with other parameters.
- Length bytes
- Sets the number of bytes of the echo request. If you do not specify the operand, the default is 256. The number of bytes must be between 8 and the maximum value determined by large envelope size (lrg_env_size). For more information about large_env_size, see z/VM: TCP/IP Planning and Customization.
- Count echo
- Sets the number of echo requests that are sent to the foreign host. If you do not specify the operand, the default is 1. The number echo must be between 1 and 231 -1 (2 147 483 647). If echo is 0, the PING command sends echo requests continually.
- Timeout seconds
- Sets the number of seconds that the PING command waits for a response. If you do not specify the operand, the default is 10. The number for seconds must be between 1 and 100.
- ADDRTYPE IPV4
- Indicates that PING is to attempt to resolve the specified host name to an IPv4 type address. If the ADDRTYPE option is not specified, PING will attempt to determine the address type to which the host name should be resolved based on a LINK option being specified, or on a SOURCEIP option being specified. If none of these options are specified, PING will first try to resolve the host name to an IPv6 address, and, if unsuccessful, it will attempt to resolve it to an IPv4 address.
- ADDRTYPE IPV6
- Indicates that PING is to attempt to resolve the specified host name to an IPv6 type address. If the ADDRTYPE option is not specified, PING will attempt to determine the address type to which the host name should be resolved based on a LINK option being specified, or on a SOURCEIP option being specified. If none of these options are specified, PING will first try to resolve the host name to an IPv6 address, and, if unsuccessful, it will attempt to resolve it to an IPv4 address.
- LINK linkname
- Allows you to specify which link to send the packet out on. The LINK parameter is valid for
pinging IPv6 targets only.
If the LINK option is not specified, the link to be used is determined from the routing table. When issuing PING to a link-local address, the LINK option must be specified or the PING will fail. This is due to the fact that all IPv6 link-local addresses have the same prefix (FE80::Interface_ID), so, depending on how the Interface_ID is generated, hosts on different links could have the same link-local address.
- SOURCEIP srcipaddr
- Allows you to specify the source IP address that is placed in the IP header when the packet is sent out. This is needed because IPv6 can have multiple IP addresses (link-local, site-local, and global) associated with a single link, and you need to verify that the PING is returned to a specific address. If the SOURCEIP option is not specified, it is determined from the home list.
- DEBUG
- Displays more detailed information about the packets being sent and received by the PING program.
Usage Notes
- More than one option can be placed on the PING command line; however, the HELP parameter is an exception and cannot be placed on the PING command line with other parameters.
- You can enter an optional parameter multiple times, but only the last instance is used.
Example: In the following example, LENGTH is used twice, which is valid, but the program uses the last one (LENGTH 1000):
ping 9.60.67.166 ( LENGTH 900 LENGTH 1000 - When the TCP/IP stack is configured to use equal-cost multipath support, and there are multiple
equal-cost paths to the destination being pinged, the ping results may seem inconsistent because the
echo requests will be sent out through different interfaces. In the example below, If you ping
10.2.1.3 twice (or once with a COUNT 2 specified), the first echo request will be sent out through
LINK1, and the second echo request will be sent out through LINK2.
GATEWAY 10.2.1.3 = LINK1 4000 HOST 10.2.1.3 = LINK2 4000 HOST - PING does not support CMS subset mode.
- If you issue HX while PING is running, the only valid command at the VM READ is BEGIN. Any other
CMS command issued will be treated as if it is the BEGIN command. You will only see the
Ready;message.
Return codes
- 0
- Command Successful.
- 4
- One or more of the PING attempts timed out.
- 8
- A communication error between PING and the TCP/IP stack occurred.
- 16
- Socket Error.
- 100
- A PING command was issued with invalid syntax.
Examples
The following are examples of using the PING command:
- PING to an IPv4 destination:
ping gdlvm7 Ping function level 720: Pinging host GDLVM7 (9.56.212.11). Enter #CP EXT to interrupt. PING: Ping #1 response took 0.024 seconds. Successes so far 1. Ready; T=0.04/0.06 12:48:12 - PING to an IPv6 destination:
ping linuxipv62.tcp (addrtype ipv6 Ping function level 720: Pinging host LINUXIPV62.TCP.raleigh.ibm.com (fec0:0:0:1:9:67:114:44) Enter #CP EXT to interrupt. PING: Ping #1 response took 0.002 seconds. Successes so far 1. Ready; T=0.04/0.06 12:48:12 - PING to an IPv6 address:
ping 50C6:C2C1::9:60:28:215 Ping Level 510: Pinging host 50C6:C2C1::9:60:28:215. Enter #CP EXT to interrupt. PING: Ping #1 response took 0.004 seconds. Successes so far 1. Ready;
