Courseiva
DiagnosticsPrivileged EXEC

ping [ip] source [intf] repeat [n]

The extended ping command allows you to specify the source interface and repeat count to test connectivity from a specific interface with a custom number of echo requests.

Definition: ping [ip] source [intf] repeat [n] is a Cisco IOS privileged exec command. The extended ping command allows you to specify the source interface and repeat count to test connectivity from a specific interface with a custom number of echo requests.

Overview

The extended ping command in Cisco IOS allows a network engineer to customize the source IP address and the number of echo requests sent during an ICMP ping test. Unlike the standard ping, which uses the closest interface IP as the source and sends five packets by default, extended ping provides granular control for advanced troubleshooting. This command is critical when testing connectivity from a specific interface, such as a loopback or a VLAN interface, to verify routing policies, firewall rules, or NAT translations.

It is also used to simulate traffic from a particular subnet or to perform stress testing with a high repeat count. The command operates in Privileged EXEC mode (enable mode) and does not affect the running configuration; it is an operational command that generates real-time output. When executed, the output is displayed immediately, but for high repeat counts, the output may be buffered and shown in batches.

Understanding extended ping is essential for CCNA and CCNP candidates because it isolates path selection issues and validates end-to-end connectivity from a specific source. Alternatives include using the standard ping (which lacks source interface control) or using traceroute for path discovery. In a troubleshooting workflow, extended ping is often the first step after verifying interface status and routing tables, as it confirms Layer 3 reachability with specific parameters.

The command requires privilege level 15 or equivalent, and it is available in all IOS versions, though syntax may vary slightly in newer releases like IOS-XE.

Syntax·Privileged EXEC
ping [ip] source [intf] repeat [n]

When to Use This Command

  • Verify connectivity from a specific loopback interface to a remote host for troubleshooting routing issues.
  • Test link reliability by sending a large number of pings (e.g., 100) to check for packet loss.
  • Confirm that a particular interface (e.g., GigabitEthernet0/1) can reach a destination when multiple paths exist.
  • Perform stress testing on a network link by sending repeated pings with a short interval.

Parameters

ParameterSyntaxDescription
ipA.B.C.DThe destination IP address to ping. This can be any valid IPv4 address. Common mistakes include pinging a broadcast address or a network address, which may cause unexpected behavior or no reply.
sourceA.B.C.D or interface name (e.g., GigabitEthernet0/0)Specifies the source IP address or interface to use for the ping. If an interface name is given, the primary IP address of that interface is used. This parameter is crucial for testing connectivity from a specific network segment. A common mistake is using an interface that is down or has no IP address, resulting in a failure to send packets.
repeat<1-2147483647>The number of ICMP echo requests to send. The default is 5. A high repeat count can be used for stress testing or to detect intermittent packet loss. Be cautious with very high values as they may impact router CPU or network bandwidth. A common mistake is forgetting to set a reasonable count, causing unnecessary traffic.

Command Examples

Extended ping from Loopback0 to 10.0.0.1 with 10 repeats

ping 10.0.0.1 source loopback 0 repeat 10
Type escape sequence to abort.
Sending 10, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.1 
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 1/2/4 ms

The command sends 10 ICMP echo requests from source IP 192.168.1.1 (Loopback0) to 10.0.0.1. Each '!' indicates a successful reply. The success rate is 100% with RTT min 1ms, avg 2ms, max 4ms.

Extended ping from GigabitEthernet0/1 to 192.168.2.1 with 5 repeats

ping 192.168.2.1 source gigabitethernet 0/1 repeat 5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.1.1 
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/3 ms

The first packet timed out ('.'), but the remaining four succeeded. The success rate is 80% (4/5). RTT values are low, indicating good performance for successful packets.

Understanding the Output

The output begins with 'Type escape sequence to abort.' indicating you can press Ctrl+^ to stop. Then it shows the number of packets, size, destination, and timeout. 'Packet sent with a source address of ...' confirms the source IP used.

Each character represents a reply: '!' success, '.' timeout, 'U' destination unreachable, 'N' network unreachable, 'P' protocol unreachable, 'Q' source quench, 'M' could not fragment, '?' unknown. The summary line shows success rate (percentage and fraction) and round-trip time statistics (minimum, average, maximum in milliseconds). A 100% success rate with low RTT indicates good connectivity; packet loss or high RTT suggests network issues.

Configuration Scenarios

Test connectivity from a loopback interface to a remote server

A network engineer needs to verify that a loopback interface (10.1.1.1) on Router A can reach a server at 192.168.100.10. This is important for BGP peering or management access.

Topology

R1(Lo0:10.1.1.1/32)---(Gi0/0:10.0.12.1/30)---(Gi0/0:10.0.12.2/30)R2---(Gi0/1:192.168.100.1/24)---Server(192.168.100.10)

Steps

  1. 1.Step 1: Enter privileged EXEC mode on R1: R1> enable
  2. 2.Step 2: Execute extended ping with source loopback 0 and repeat 10: R1# ping 192.168.100.10 source loopback 0 repeat 10
  3. 3.Step 3: Observe the output for success rate and round-trip times.
Configuration
! No configuration changes needed; this is an operational command.
R1# ping 192.168.100.10 source loopback 0 repeat 10

Verify: Expected output: 'Success rate is 100 percent (10/10), round-trip min/avg/max = 1/2/5 ms'

Watch out: If the loopback interface is not advertised in the routing protocol, the return traffic may not reach R1. Ensure the loopback is included in the routing updates.

Simulate traffic from a specific subnet to test firewall rules

A firewall between two routers is configured to allow traffic only from the 172.16.0.0/16 subnet. The engineer needs to test if a ping from a host in that subnet (simulated by sourcing from a loopback with IP 172.16.1.1) can reach the destination.

Topology

R1(Lo1:172.16.1.1/16)---(Gi0/0:10.0.13.1/30)---Firewall---(Gi0/0:10.0.13.2/30)R2---(Gi0/1:10.0.0.1/24)---Host(10.0.0.10)

Steps

  1. 1.Step 1: Enter privileged EXEC mode on R1: R1> enable
  2. 2.Step 2: Use extended ping with source IP 172.16.1.1 and repeat 3: R1# ping 10.0.0.10 source 172.16.1.1 repeat 3
  3. 3.Step 3: Check if the ping succeeds; if not, verify firewall rules and routing.
Configuration
! No configuration change; command only.
R1# ping 10.0.0.10 source 172.16.1.1 repeat 3

Verify: Expected output on success: 'Success rate is 100 percent (3/3), round-trip min/avg/max = 2/3/4 ms'. If blocked, output shows 'Success rate is 0 percent (0/3)'.

Watch out: The source IP must be reachable on the network; ensure the loopback interface is up and has a route back to the destination.

Troubleshooting with This Command

When troubleshooting connectivity issues, the extended ping command is invaluable because it allows you to isolate the source of the problem. Healthy output shows a success rate of 100% with consistent round-trip times. Problem indicators include partial success (e.g., 3/5) indicating packet loss, or 0% success indicating no connectivity.

Focus on the success rate and the min/avg/max round-trip times. High average times suggest latency issues, while packet loss may indicate congestion, faulty links, or ACL drops. Common symptoms this command helps diagnose include: asymmetric routing (where the source interface matters), firewall filtering (by sourcing from an allowed subnet), and NAT issues (by verifying the source IP after translation).

A step-by-step diagnostic flow: 1) Start with a standard ping to confirm basic reachability. 2) If that fails, use extended ping with a specific source interface to test if the issue is source-dependent. 3) If the extended ping fails, check routing tables for the source and destination. 4) Use traceroute to identify the failing hop. 5) Correlate with show ip interface brief to ensure the source interface is up/up. 6) Check ACLs with show access-lists to see if packets are being denied. 7) Use debug ip icmp (with caution) to see if echo replies are received. The extended ping output can be correlated with show ip route to verify that the source IP has a route to the destination. For example, if the ping fails from a loopback but succeeds from a physical interface, the loopback may not be advertised in the routing protocol.

CCNA Exam Tips

1.

Remember that the 'source' keyword requires an interface name, not an IP address; the router uses the interface's primary IP.

2.

The 'repeat' option is essential for testing link reliability; CCNA may ask about interpreting success rates.

3.

Know that extended ping can be used to test policy-based routing by sourcing from a specific interface.

4.

In the exam, be prepared to identify the source IP used based on the interface specified.

Common Mistakes

Using an IP address instead of an interface name after 'source' (e.g., 'source 192.168.1.1' is invalid).

Forgetting that the source interface must have an IP address configured; otherwise the command fails.

Assuming the repeat count includes the first packet; it does—repeat 10 sends 10 packets total.

ping [ip] source [intf] repeat [n] vs ping [ip]

The standard 'ping [ip]' command is the most common tool for basic connectivity checks, but it uses the routing table's default source IP and sends only five echo requests. The extended variant 'ping [ip] source [intf] repeat [n]' gives precise control over source interface and repetition count, making it essential for testing specific paths or slow links. These commands are often confused because their syntax and output are similar, yet their capabilities differ significantly.

Aspectping [ip] source [intf] repeat [n]ping [ip]
ScopeExtended control over source and repeat countUses default source and five repeats
Source InterfaceExplicitly specify source via interface nameAutomatic source IP based on routing table
Repeat CountUser-defined number of echo requests (n)Fixed at 5 echo requests
Output DetailSame output format, but allows per-packet statistics if enabled globallyStandard summary of round-trip times
Configuration RequiredNo extra configuration; command-line options onlyNone
Typical UseVerify connectivity from a specific interface or adjust timeout/test durationQuick reachability check from any available source

Use ping [ip] source [intf] repeat [n] when you need to test connectivity from a specific interface (e.g., loopback) or require more (or fewer) ping packets to assess path stability over time.

Use ping [ip] for a quick, default reachability test from any working interface, such as during initial troubleshooting or when source interface is irrelevant.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches), the extended ping command syntax is identical to classic IOS. However, the output format may be slightly different, with additional fields like 'Sending 10, 100-byte ICMP Echos to 192.168.100.10, timeout is 2 seconds:' and the results displayed in a table. In NX-OS (e.g., Nexus switches), the equivalent command is 'ping <ip> source <interface> count <n>' but note that NX-OS uses a different syntax: you must specify the source interface or IP after the 'source' keyword, and the repeat count is set with 'count'.

For example: 'ping 192.168.100.10 source loopback0 count 10'. The NX-OS output is similar but may show 'packet-size' and 'df-bit' options. On Cisco ASA firewalls, the extended ping is available in privileged mode as 'ping <ip> source <interface> repeat <n>', but the ASA does not support sourcing from a loopback (as loopbacks are not typically used).

In IOS-XR (e.g., ASR 9000), the command is 'ping <ip> source <interface> count <n>' and the output is more verbose, showing each reply. There are no significant differences between IOS 12.x, 15.x, and 16.x for this command, though newer versions may support IPv6 extended ping with similar parameters. Always check the specific platform documentation for exact syntax.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions