Using the Ping command

The packet Internet groper (Ping) command sends an Internet Control Message Protocol (ICMP/ICMPv6) Echo Request to a host, gateway, or router with the expectation of receiving a reply. You can invoke the Ping function by using the TSO PING command or the z/OS® UNIX shell ping or oping command.

For a complete description of the Ping command and examples of Ping output, see the z/OS Communications Server: IP System Administrator's Commands.

The Ping command does not use the ICMP/ICMPv6 header sequence number field (icmp_seq or icmp6_seq) to correlate requests with ICMP/ICMPv6 Echo Replies. Instead, it uses the ICMP/ICMPv6 header identifier field (icmp_id or icmp6_id) plus an 8-byte TOD time stamp field to correlate requests with replies. The TOD time stamp is the first 8-bytes of data after the ICMP/ICMPv6 header. When you specify the Verbose/-v parameter, the ICMP/ICMPv6 header sequence numbers sent in the ICMP/ICMPv6 echo requests are displayed in the verbose report of detailed ICMP/ICMPv6 echo replies. Use these sequence numbers to detect the out-of-order and lost packets, based on missing sequence numbers.

When the PMTU/-P parameter with a value of yes or ignore is specified on the command, Ping will ensure that the outbound echo request packets are not fragmented. As a result, ICMP/ICMPv6 error messages may be received by the Ping command if the echo request packet is too large to be sent out by the stack or, forwarded at some point in the network. In this case, the Ping command uses both the ICMP/ICMPv6 header identifier and sequence number fields to correlate requests with the error messages. For IPv6 Ping requests, the Ping command will also use the 8-byte TOD time stamp returned in the ICMPv6 Packet Too Big error message.

Ping can be used in the following ways:

Pinging loopback is used to verify the installation of TCP/IP in the z/OS Communications Server environment.
The Ping loopback is an internal software test. The command examples below use the IPv4 standard loopback address, 127.0.0.1, or the IPv6 standard loopback address, ::1. An IP packet is not sent to a physical device.
ping 127.0.0.1                            
For IPv6
 ping ::1
Ping a home address to verify the information from the Netstat HOME/-h command.
This is an internal software test. An IP packet is not sent to a physical device.
ping 9.67.113.58                          
Ping a host on a directly attached network to verify the following:
  • If equal-cost multipath routes exist in the IP routing table for outbound IP traffic to reach a remote host, use the Ping INTF/-i option to select a routing interface with the attached equal-cost multipath route. Alternatively, for routing interfaces associated with an IPv6 link-local address, the name of the routing interface can be appended as scope information to the IPv6 link-local address of the remote host. When running multiple TCP/IP stacks on the same MVS™ image, specify the TCP/-p parameter, along with the scope, to indicate the stack to which the routing interface is configured. Whenever applicable, use either of these options to test connectivity. For more information about using scope, see the section on support for scope in z/OS Communications Server: IPv6 Network and Application Design Guide.
  • The directly attached network is defined correctly.
  • The device is properly connected to the network.
  • The device is able to send and receive packets on the network.
  • The remote host is able to receive and send packets.
ping 9.67.43.101 (intf eth1
ping fe80::9:67:43:104%ethipv61 -p tcpip1
Ping a host on a remote network to verify the following:
  • If equal-cost multipath routes exist in the IP routing table for outbound IP traffic to reach the remote host, use the Ping INTF/-i option to select a routing interface with the attached equal-cost multipath route. Whenever applicable, use this option to test connectivity.
  • The route to the remote network is defined correctly.
  • The router is able to forward packets to the remote network.
  • The remote host is able to send and receive packets on the network.
  • The remote host has a route back to the local host.
ping -i eth1 mvs1 
Note: Ping commands to a remote host might fail if there is a firewall between the two systems, even if the host is reachable using other commands.
Display details of echo replies and obtain summary statistics
You can use the Ping command with the Verbose/-v parameter to obtain detailed echo replies and summary statistics regarding the round-trip times based on the response times in the received echo replies. The detailed echo replies can be used to identify lost echo reply packets based on their sequence numbers and to identify how many hops the echo requests have traveled based on their values of time-to-live (TTL) or maximum number of hops (hop limits). The Verbose/-v parameter provides the following output information:
  • Number of bytes for the ICMP data portion
  • Echo reply details (for each echo reply received):
    • from: echo reply sender's IP address
    • seq: ICMP/ICMPv6 sequence number
    • ttl: time-to-live for number of hops (if IPv4)
    • hoplim: maximum hop limit (if IPv6)
    • time: response time
  • Ping statistics summary:
    • Packets history:
      • Sent: total number of echo requests sent
      • Received: total number of echo replies received
      • Lost: total number of packets lost plus percentage of packet loss
    • Approximate round-trip times in milliseconds:
      • Minimum: minimum value among all RTTs
      • Maximum: maximum value among all RTTs
      • Average: average RTT among all RTTs
      • StdDev for standard deviation among all RTTs
ping mvs1 (verbose ping -v mvs1

For examples of Ping verbose reports, see z/OS Communications Server: IP System Administrator's Commands.

Determine the path MTU size to a host:
Use the Ping PMTU/-P parameter with the values yes or ignore, to prevent fragmentation of the outbound echo request packets and specify what type of path MTU discovery support you want. If the outbound packet needs to be fragmented, Ping will display the host name and IP address of the host where the fragmentation is needed.
yes
Specifies that the outbound echo request packets will not be fragmented at the local host or in the network, and that you want to use the MTU value, determined by path MTU discovery for the destination.
  • If path MTU discovery is enabled and has already determined an MTU value for the destination, and the length of the Ping echo request packet is larger than this MTU size, then the local TCP/IP stack will not send out the packet. In this case, Ping displays one of the local stack's IP addresses as the address of the host where fragmentation is needed, and the next-hop MTU value displayed by Ping is the current path MTU value to the destination. For Ping commands to IPv4 destinations, the Ping command processing will not cause path MTU discovery support to be triggered for the destination. For IPv4, only TCP processing causes path MTU discovery support to be triggered
  • If path MTU discovery is not enabled, or has not already determined a path MTU value for the destination, and the Ping echo request packet exceeds the configured route MTU selected for this packet, then the local TCP/IP stack will not send out the packet. In this case, Ping will display one of the local stack's IP addresses as the address of the host where fragmentation is needed, and the next-hop MTU value displayed by Ping is that of the route selected for the Ping packet.
  • If the Ping request fails because the echo request packet needs to be fragmented at some point in the network, Ping will display the IP address where fragmentation needs to occur and will display the next-hop MTU value, if it was provided.
ignore
Specifies that the outbound echo request packets will not be fragmented at the local host or in the network, and that any MTU values determined by path MTU discovery for the destination, will be ignored.
  • If path MTU discovery has determined an MTU value for the destination, and the length of the Ping echo request packet is larger than this MTU size, specifying a value of ignore causes the TCP/IP stack to ignore the path MTU value and attempt to send out the packet. As long as the echo request packet length does not exceed the configured route MTU selected for this packet, you can use the ignore value to determine where in the network the original MTU problem occurred. In this case, Ping displays the IP address where fragmentation needs to occur and will display the path MTU value, if it was provided.
  • If the Ping echo request packet exceeds the configured route MTU selected for this packet, then the local TCP/IP stack will not send out the packet. In this case, Ping displays one of the local stack's IP addresses as the address of the host where fragmentation is needed, and the next-hop MTU value displayed by Ping is that of the route selected for the Ping packet.
MULTIPATH PERPACKET considerations:
When MULTIPATH PERPACKET is in effect, and equal-cost routes are configured to the Ping destination host, the smallest MTU value of all the equal-cost routes is used as the largest packet size which can be sent, even if some of the equal-cost routes could support a larger packet size.
  • Specify the NONAME/-n parameter to request that Ping only display the IP address of the host, and not attempt to resolve the IP address to a host name. This saves a name server address-to-name lookup. If this host also returned the next-hop MTU size, the size is also displayed.
  • Vary the length of the outbound packet to determine where the packet needs to be fragmented. The Length/-l parameter on the Ping command, specifies the number of data bytes for the echo request.
    • For IPv4 destinations, the total length of the outbound echo request packet includes the length of an IPv4 IP header (20 bytes), the length of an ICMP header (8 bytes), and the data length specified by the Length/-l parameter. Depending on your TCP/IP stack configuration, the TCP/IP stack might add additional IP header options to the IP header created by Ping, before the echo request packet is sent, thereby increasing the size of the packet.
    • For IPv6 destinations, the total length of the outbound echo request packet includes the length of an IPv6 IP header (40 bytes), the length of an ICMPv6 header (8 bytes), and the data length specified by the Length/-l parameter. Depending on your TCP/IP stack configuration, the TCP/IP stack might add additional IPv6 extension headers to the packet created by Ping, before the echo request packet is sent, thereby increasing the size of the packet.