Extended ping command

The ping command in Cisco IOS (and other operating systems) is used to test the accessibility of devices on a TCP/IP network. Cisco devices also support the extended ping command that allows you to perform a more advanced check of the host reachability and network connectivity. With this command, you can define the source IP address as any IP address on the router, number and size of ping packets, different timeout interval, etc.

The extended ping command is invoked from the privileged exec mode by typing ping and pressing Enter. The following arguments can be modified:

  • Protocol [ip] – specify the protocol, such as appletalk, clns, ip, novell, apollo, vines, decnet, or xns. The default is ip.
  • Target IP address – specify the IP address or the hostname of the host to ping.
  • Repeat count – specify the number of ping packets that will be sent to the destination address. 5 by default.
  • Datagram size – specify the size of the ping packet (in bytes). The default is 100 bytes.
  • Timeout in seconds – specify the timeout interval. The default is 2 seconds. The echo reply needs to be received before the timeout expires in order for ping to be successful.
  • Extended commands – specify whether or not a series of additional commands will appear. The default is no. If you type yes additional arguments will be shown.
  • Source address or interface – specify the interface or the IP address of the router to use as the source address for the ping packets.
  • Type of service – specifies the Type of Service (ToS). This is the Internet service’s quality selection. The default is 0.
  • Set DF bit in IP header? – specify whether or not the Don’t Fragment (DF) bit will be set on the ping packet. If yes is entered, the Don’t Fragment option does not allow the packet to be fragmented. The default is no.
  • Validate reply data? – specify whether or not to validate the reply data. The default is no.
  • Data pattern – specify the data pattern. Data patterns are used to troubleshoot framing errors and clocking problems on serial lines. The default is [0xABCD].
  • Loose, Strict, Record, Timestamp, Verbose – specify the IP header options.
  • Sweep range of sizes – specify the sizes of the ping echo packets that are sent. This parameter is used to determine the minimum sizes of the MTUs configured on the nodes along the path to the destination address. The default is no.

 

The extended ping command is most often used to change the source IP address of the ping echo packets. Consider the following example:

Extended ping Cisco router example

By default, routers choose the IP address of the outgoing interface as the source IP address for ping echo packets. This means that R2 will use the IP address of the Fa0/1 interface (10.0.0.1) as the source IP address for the ping packets sent to 10.0.0.2 (R1). Let’s try to ping R1 using the standard ping command:

R2#ping 10.0.0.2

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

As you can see from the output, the ICMP replies were received. However, I can run the extended ping command to change the source IP address to the IP address of the R2 Fa0/0 interface (192.168.5.1). This is done to ensure that R1 knows about the 192.168.5.1 network (in other words, that it knows where to send packets destined for the 192.168.5.0/24 network, which could indicate routing problems).

R2#ping
Protocol [ip]:
Target IP address: 10.0.0.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: yes
Source address or interface: 192.168.5.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
Packet sent with a source address of 192.168.5.1
.....
Success rate is 0 percent (0/5)

In the output above you can see that no echo replies were received after I’ve changed the source IP of the ping packets. This means that R1 doesn’t know how to reach the 192.168.5.0/24 network.


upravnik