Use extended ping
The ping command is used to test the accessibility of devices on a TCP/IP network. Cisco IOS also supports the extended ping command that enables you to perform a more advanced check of the host reachability and network connectivity. For example, with the extended ping command, you can define the source IP address as any IP address on the router, number 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 parameters 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 hostname of the host you want to ping.
- Repeat count – specify the number of ping packets that will be sent to the destination address. The default is 5.
- 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.
- Source address or interface – specify the interface or IP address of the router to use as a 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 this 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:
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 as the source IP address for its ping packets (10.0.0.1). We 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.1/24 network):
In the picture above you can see that echo replies were received. This means that R1 knows that the packets destined for the 192.168.5.0 should be send out its Fa0/0 interface.