This document illustrates the use of the ping and traceroute commands. With the aid of some debug commands, this document captures a more detailed view of how these commands work.
Note: Enabling any debug commands on a production router may cause serious problems. We recommend that you carefully read the section before you issue debug commands.Prerequisites Requirements
There are no specific requirements for this document.Components Used
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.Conventions
For more information on document conventions, refer to the Cisco Technical Tips Conventions.Background Information
In this document, we use the basic configuration shown below as a basis for our examples:
The Ping Command
The ping command is a very common method for troubleshooting the accessibility of devices. It uses a series of Internet Control Message Protocol (ICMP) Echo messages to determine:
Whether a remote host is active or inactive.
The round-trip delay in communicating with the host.
The ping command first sends an echo request packet to an address, then waits for a reply. The ping is successful only if:
the echo request gets to the destination, and
the destination is able to get an echo reply back to the source within a predetermined time called a timeout. The default value of this timeout is two seconds on Cisco routers.
For all the options about this command, see "Ping" under Troubleshooting Commands.
The TTL value of a ping packet cannot be changed.
Here is an output example showing the ping command after enabling the debug ip packet detail command:
Warning: Using the debug ip packet detail command on a production router can cause high CPU utilization. This may result in a severe performance degradation or a network outage. We recommend that you carefully read before issuing debug commands. Router1#debug ip packet detail IP packet debugging is on (detailed) Router1#ping 126.96.36.199 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 188.8.131.52, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms Router1# Jan 20 15:54:47.487: IP: s=184.108.40.206 (local), d=220.127.116.11 (Serial0), len 100, sending Jan 20 15:54:47.491: ICMP type=8, code=0 !--- This is the ICMP packet 18.104.22.168 sent to 22.214.171.124. !--- ICMP type=8 corresponds to the echo message. Jan 20 15:54:47.523: IP: s=126.96.36.199 (Serial0), d=188.8.131.52 (Serial0), len 100, rcvd 3 Jan 20 15:54:47.527: ICMP type=0, code=0 !--- This is the answer we get from 184.108.40.206. !--- ICMP type=0 corresponds to the echo reply message. !--- By default, the repeat count is five times, so there will be five !--- echo requests, and five echo replies.
The table below lists possible ICMP-type values.
ICMP Type Literal
3 destination unreachable code 0 = net unreachable 1 = host unreachable 2 = protocol unreachable 3 = port unreachable 4 = fragmentation needed and DF set 5 = source route failed
5 redirect code 0 = redirect datagrams for the network 1 = redirect datagrams for the host 2 = redirect datagrams for the type of service and network 3 = redirect datagrams for the type of service and host
11 time-exceeded code 0 = time to live exceeded in transit 1 = fragment reassembly time exceeded
The table below lists the possible output characters from the ping facility:
! Each exclamation point indicates receipt of a reply.
. Each period indicates the network server timed out while waiting for a reply.
U A destination unreachable error PDU was received.
Q Source quench (destination too busy).
M Could not fragment.
? Unknown packet type.
& Packet lifetime exceeded.Why Can't I Ping?
If you are not able to successfully ping to an address, consider these causes:Routing Issue
Here are examples of unsuccessful ping attempts, determining the problem, and what to do to resolve the problem.
This scenario is explained using the network topology diagram below: