Command
Ping
Use
Allows you to verify reachbility of a remote device. This is one of the most useful of the diagnogstic commands.
Syntax
Router#ping <ip address or DNS name>
OR
Router#ping
Optional Switches
data
df-bit
repeat
size
source
timeout
validate
Example
In this example a user pings from R1 to R2. The ‘.‘ represents a failure and the ‘!‘ represents a success. If you ever see a single failure at the being of a ping that usually means the router hasn’t finished its ARP process for the destination.
R1(config-if)#do ping 10.1.1.2 Type escape sequence to abort. |
You can use the repeat option with the ping command to specify how many times the router will ping the remote host.
R1#ping 10.1.1.2 repeat 100 Type escape sequence to abort. |
You can also use the size option to set the size of the ping packet. This is useful for a variety of reasons, but at the CCNA level, the best use is making sure the downstream routers can support abnormal MTUs (Maximum Transmission Unit). The MTU is the maximum size that a router will allow a packet to be for it to transmit..
Additionally you can use the df-bit with your testing to prevent the routers from fragmenting the packet.
R1#ping 10.1.1.2 size 2000 Type escape sequence to abort. Type escape sequence to abort. R1#ping 10.1.1.2 size 1500 df-bit Type escape sequence to abort. |
One of the more useful options is source. Source allows you to send a ping from any interface you want on the router.
By default ping will source its ping from the closest match in the routing table. You may want to change the source-interface to
verify proper routing.
In the below example R1 tries to ping R2 via it’s Loopback 0 interface. Looking at the debug ip packet output on R2,
we can see that packets to 1.1.1.1 are unroutable. This means the route 1.1.1.1 is not in R2’s routing table.
R1#ping 10.1.1.2 source loopback 0 Type escape sequence to abort. R2#debug ip packet |
Checking the routing table on R2 confirms that there is no route for 1.1.1.1
R2#show ip route Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets |
Lets quickly add a static route to fix this problem
R2(config)#ip route 1.1.1.1 255.255.255.255 10.1.1.1 |
And now we can ping.
R1#ping 10.1.1.2 source loopback 0 Type escape sequence to abort. |
Finally, you can a lot more options using extended ping. This is done by simply typing the ping command.
Many of the options of this command have been discussed already or are out of the CCNA scope. If your IOS doesn’t support using the ping options,
then you can do the same thing with the extended ping.
R1#ping |