DiagnosticsEXEC

ping [ip]

Tests basic network connectivity to a remote host by sending ICMP echo requests and waiting for replies.

Overview

The ping command is a fundamental network diagnostic tool used to test IP-level connectivity between two devices. It sends Internet Control Message Protocol (ICMP) Echo Request packets to a specified destination IP address or hostname and listens for ICMP Echo Reply packets. The success rate and round-trip time (RTT) provide immediate feedback on network reachability and performance. In Cisco IOS-XR, the ping command is executed from the EXEC mode and supports a variety of options to customize the test, such as setting the source address, packet size, count, timeout, and the Don't Fragment (DF) bit. It is commonly used during initial network setup, after configuration changes, and during troubleshooting to isolate connectivity issues. Unlike classic IOS, IOS-XR does not use an interactive prompt for extended ping; instead, all parameters are specified as command-line arguments. This command is essential for verifying that routing is working correctly and that there are no firewall or ACL blocks. It fits into troubleshooting workflows as a first step to confirm Layer 3 connectivity before moving to more advanced diagnostics like traceroute or path verification.

Syntax·EXEC
ping [ip-address | hostname] [source source-ip-address] [count number] [size bytes] [timeout seconds] [df-bit] [vrf vrf-name] [verbose]

When to Use This Command

  • Verify connectivity to a remote server after configuring a new static route.
  • Check if a default gateway is reachable from a router interface.
  • Test latency and packet loss to a customer edge device during troubleshooting.
  • Validate reachability to a loopback address across an MPLS VPN.

Parameters

ParameterSyntaxDescription
ip-address | hostnameA.B.C.D | WORDThe destination IP address or hostname to ping. If a hostname is used, it must be resolvable via DNS or the router's host table.
sourcesource A.B.C.DSpecifies the source IP address for the ping packets. Useful when testing connectivity from a specific interface or when multiple IP addresses exist on the router.
countcount <1-4294967295>Number of ICMP echo requests to send. Default is 5. Increasing count helps detect intermittent packet loss.
sizesize <36-18024>Size of the ICMP echo request packet in bytes (including IP and ICMP headers). Default is 100. Use larger sizes to test MTU issues.
timeouttimeout <1-30>Time in seconds to wait for each reply before considering it lost. Default is 2 seconds.
df-bitdf-bitSets the Don't Fragment bit in the IP header. If the packet exceeds the path MTU, it will be dropped, helping detect MTU problems.
vrfvrf WORDSpecifies the VRF (VPN Routing and Forwarding) instance to use for the ping. Required when the destination is in a VRF.
verboseverboseDisplays additional details such as the source address used and the DF bit status. Useful for debugging.

Command Examples

Basic ping to a remote host

ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

The '!!!!!' indicates all five echo replies were received. The success rate is 100%, and round-trip times are shown in milliseconds.

Ping with extended options

ping 10.2.2.2 source 192.168.1.1 count 10 size 1500 df-bit verbose
Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 10.2.2.2, timeout is 2 seconds:
Packet sent with source address 192.168.1.1
Packet has DF bit set
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 2/3/5 ms

The source address is specified, packet size is 1500 bytes, DF bit is set to test MTU, and verbose shows additional details. All 10 packets succeeded.

Understanding the Output

The ping output begins with a header showing the number of packets, size, destination, and timeout. Each exclamation mark (!) represents a successful reply; a period (.) indicates a timeout. The success rate is the percentage of successful replies. Round-trip time (RTT) statistics show minimum, average, and maximum times in milliseconds. High RTT or packet loss suggests network congestion, faulty links, or routing issues. A success rate below 100% indicates intermittent connectivity problems. The 'verbose' option adds details like source address and DF bit status.

Configuration Scenarios

Ping across a VRF

A service provider router with multiple VRFs. You need to test connectivity to a customer device in VRF CUSTOMER_A.

Topology

Router1 (PE) --- Customer_A (CE) in VRF CUSTOMER_A

Steps

  1. 1.Identify the VRF name and the CE's IP address.
  2. 2.Execute ping with the vrf keyword.
Configuration
! No configuration needed; command is executed in EXEC mode.
ping vrf CUSTOMER_A 10.10.10.1

Verify: Check the success rate and RTT. If unsuccessful, verify VRF configuration and route leaking.

Watch out: Omitting the vrf keyword will cause the ping to use the global routing table, likely resulting in failure.

MTU testing with DF bit

Users report slow performance; suspect MTU mismatch on a link.

Topology

Router1 --- Router2 (MTU 1500) --- Server

Steps

  1. 1.Ping with increasing packet sizes and DF bit set.
  2. 2.Observe at which size packets start to fail.
Configuration
! Test with 1500-byte packets
ping 10.20.20.2 size 1500 df-bit
! Test with 1476-byte packets (common for GRE tunnels)
ping 10.20.20.2 size 1476 df-bit

Verify: If 1500-byte pings fail but 1476 succeed, the path MTU is likely 1500 with overhead. Adjust interface MTU or configure TCP MSS clamping.

Watch out: Some intermediate devices may drop ICMP unreachable messages needed for PMTUD, causing black holes.

Troubleshooting with This Command

When troubleshooting connectivity issues with ping on Cisco IOS-XR, start with a basic ping to the destination. If it fails, check the following: 1) Ensure the destination is reachable via the routing table using 'show ip route <destination>'. 2) Verify that the source interface is up and has an IP address. 3) Check for ACLs or firewall rules that might block ICMP. Use the 'verbose' option to see the source address used; if it's not the expected one, use the 'source' option to specify it. If pings succeed but with high latency or packet loss, consider network congestion, faulty hardware, or duplex mismatches. Use the 'count' option with a larger number to get a better sample. For MTU issues, use the 'df-bit' option with increasing packet sizes to find the maximum MTU. In VRF environments, always specify the VRF; otherwise, the ping will use the global table. If pings fail intermittently, run a continuous ping (using a script or repeated commands) to capture the pattern. Remember that some devices may be configured to ignore ICMP echo requests for security reasons; in that case, use other methods like traceroute or TCP port tests. IOS-XR also supports IPv6 ping with the 'ping ipv6' command, which has similar options.

CCNA Exam Tips

1.

Remember that in IOS-XR, the ping command uses a different syntax for extended options compared to classic IOS; options are typed inline rather than via interactive prompts.

2.

Know that the 'df-bit' option is used to test Path MTU Discovery; if packets are dropped, you may see '...' instead of '!!!!!'.

3.

Be aware that the 'vrf' keyword is required to ping a host in a specific VRF; omitting it may result in unreachability.

Common Mistakes

Forgetting to specify the VRF when pinging a host in a VRF, leading to false negative results.

Using the classic IOS interactive ping syntax (typing 'ping' and pressing Enter) which does not work in IOS-XR; instead, all parameters must be on the command line.

Assuming that a single successful ping confirms end-to-end connectivity; packet loss may be intermittent.

Platform Notes

In Cisco IOS-XR, the ping command syntax differs from classic IOS. Classic IOS uses an interactive menu when 'ping' is entered without arguments, allowing step-by-step configuration of extended options. IOS-XR does not support this interactive mode; all options must be specified as command-line arguments. For example, to set the source address in classic IOS, you would type 'ping' then 'Protocol [ip]:', 'Target IP address:', etc. In IOS-XR, you type 'ping 10.1.1.1 source 192.168.1.1'. Additionally, IOS-XR requires the 'vrf' keyword to ping within a VRF, whereas classic IOS uses the 'ping vrf' command. The output format is similar but may include additional fields like 'Packet sent with source address' when verbose is used. On other platforms like Juniper Junos, the equivalent command is 'ping <host> source <address> count <n> size <n> do-not-fragment'. On Linux, it's 'ping -c <count> -s <size> -M do <destination>'. Understanding these differences is crucial for multi-vendor environments. IOS-XR versions may also support additional options like 'sweep' for varying packet sizes, but the core functionality remains consistent.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions