Traceroute command
Overview
This document describes the common command formats, fundamentals, and usage examples of the traceroute function.The tracert command is used on Huawei datacom products to implement the traceroute function.
Requirements
Knowledge Requirements
This document requires its readers to have a basic understanding of IP technologies and the tracert command.
Software and Hardware Requirements
This document applies to the following hardware models and software version:
- Hardware models: Huawei NE, ME, and CX series routers
- Software version: V800R011C10
Fundamentals
The tracert command traceroutes the path along which a data packet passes from the sender (the source) to the receiver (the destination). It is often used together with the ping command to locate a fault on the network.
Command Format and Parameter Description
- The following lists the common format of the tracert command. For details about other formats of the command, see the command reference sections in the product documentation.
tracert [ -a source-ip-address | -f first-TTL | -m max-TTL | -p port | -q nqueries | -w timeout ] * host
The value ranges in Table 1-1 are based on a Huawei NE40E running V800R011C10. The actual value ranges vary according to device models and software versions.
Table 1-1 Parameter description of the tracert commandParameter
Description
Value
-a source-ip-address
Specifies the source address of trace packets. source-ip-address is the IP address of the local interface.
The value is in dotted decimal notation.
-f first-TTL
Specifies the initial time to live (TTL) of trace packets.
Carried in the IP header, the TTL field indicates the lifetime of a trace packet and specifies the maximum number of devices that the packet can pass through. The TTL value is set on the source and reduced by 1 each time the packet passes through one device. When the TTL value is reduced to 0, the packet is discarded, and an ICMP Time Exceeded message is sent to the source.
If first-TTL is specified and the number of hops that a trace packet passes through is less than the specified value, the TTL value will be greater than 0 after the packet passes through all the nodes. In this case, no ICMP Time Exceeded message is sent to the source.
If max-TTL is also specified, the value of first-TTL must be smaller than the value of max-TTL.
The value is an integer ranging from 1 to 255. The default value is 1.
-m max-TTL
Specifies the maximum TTL.
Generally, the value of max-TTL is set to the number of hops that the packet passes through. To change the TTL value, specify this parameter.
If first-TTL is specified, the value of max-TTL must be greater than the value of first-TTL.
The value is an integer ranging from 1 to 255. The default value is 30.
-q nqueries
Specifies the number of trace packets to be sent in a traceroute test.
If network quality is poor, you can increase the parameter value to improve the probability of a trace packet reaching the destination.
The value is an integer ranging from 1 to 65535. The default value is 3.
-w timeout
Specifies the length of time to wait for a reply.
If sending a trace packet to a gateway times out, an asterisk (*) is displayed.
If network quality is poor and the transmission rate is low, you can increase the parameter value to prolong the timeout period.
The value is an integer ranging from 0 to 3600000, in milliseconds. The default value is 5000.
host
Specifies the name or IPv4 address of a destination.
The value is a string of 1 to 255 characters.
NOTE:If the IP address of a destination is specified, the value is in dotted decimal notation.
- The following lists the common format of the tracert ipv6 command. For details about other formats of the command, see the command reference sections in the product documentation.
tracert ipv6 [ -ffirst-hop-limit | -mmax-hop-limit | -wtimeout ] *host-name
The value ranges in Table 1-2 are based on a Huawei NE40E running V800R011C10. The actual value ranges vary according to device models and software versions.
Table 1-2 Parameter description of the tracert ipv6 commandParameter
Description
Value
-f first-hop-limit
Specifies an initial hop limit of trace packets.
Carried in the IPv6 header, the Hop Limit field indicates the lifetime of an IPv6 packet and specifies the maximum number of devices through which the packet can pass. This field is similar to the TTL field in IPv4 packets. The Hop Limit value is set on the source and subsequently reduced by 1 each time the packet passes through one device. When the Hop Limit value is reduced to 0, the packet is discarded, and an ICMPv6 Time Exceeded message is sent to the source.
If first-hop-limit is specified and the number of hops that a packet passes through is less than the specified value, the first-hop-limit value will be greater than 0 after the packet passes through all the nodes. In this case, no ICMPv6 Time Exceeded message is sent to the source.
If max-hop-limit is also specified, the value of first-hop-limit must be smaller than the value of max-hop-limit.
The value is an integer ranging from 1 to 255. The default value is 1.
-m max-hop-limit
Specifies a maximum hop limit.
Usually, the max-hop-limit value is set to the number of hops that packets pass through. To change the maximum hop limit, specify this parameter.
If first-hop-limit is also specified, the value of max-hop-limit must be greater than the value of first-hop-limit.
The value is an integer ranging from 1 to 255. The default value is 30.
-q probes
Specifies the number of trace packets to be sent in a traceroute test.
If network quality is poor, you can increase the parameter value to improve the probability of a trace packet reaching the destination.
The value is an integer ranging from 1 to 65535. The default value is 3.
-w timeout
Specifies the length of time to wait for a reply.
If sending a trace packet to a gateway times out, an asterisk (*) is displayed.
If network quality is poor and the transmission rate is low, you can increase the parameter value to prolong the timeout period.
The value is an integer ranging from 1 to 65535, in milliseconds. The default value is 5000.
host-name
Specifies the name or IPv6 address of a destination.
The value is a string of 1 to 255 characters.
NOTE:If the IPv6 address of a destination is specified, the value is in the format of X:X:X:X:X:X:X:X.
Implementation Procedure
Assume that the initial TTL value of tracert packets is 1 and the number of tracert packets sent each time is 1. The procedure is as follows:
A source sends a packet with the TTL being 1. After the TTL times out, the first hop sends an ICMP Error message to the source, indicating that the packet cannot be forwarded.
The source sends a packet with the TTL being 2. After the TTL times out, the second hop sends an ICMP Error message to the source, indicating that the packet cannot be forwarded.
The source sends a packet with the TTL being 3. After the TTL times out, the third hop sends an ICMP Error message to the source, indicating that the packet cannot be forwarded.
- The preceding process continues until a packet reaches the destination. (If the destination is still unreachable after the TTL value is increased to the maximum value specified in the tracert command, the traceroute operation stops.)
When receiving a packet, each destination hop searches for the port specified in the packet. If no such port is found, the destination hop sends back an ICMP Port Unreachable message, indicating that the destination port is unreachable. In this case, the traceroute operation ends. This procedure allows the source of each ICMP Time Exceeded message to be recorded so that the path through which the packet passed to the destination can be traced.
The implementation procedure of the tracert ipv6 command is similar to the preceding procedure.
Usage Examples
- -q: If network quality is poor, you can increase the parameter value so that a trace packet can reach the destination.
- -w: If network quality is poor and the transmission rate is low, you can increase the parameter value to prolong the timeout period.
Example for Using the tracert Command on an IPv4 Network
# Trace the gateways from the source to the destination at 10.10.0.10. Set the number of trace packets to be sent to 5 and the timeout period to 8000 ms.
<HUAWEI> tracert -q 5 -w 8000 10.10.0.10 traceroute to 10.10.0.10 (10.10.0.10), hops max: 18, packet length: 40,press CTRL_C to break 1 10.3.112.1 (10.3.112.1) 17 ms 17 ms 27 ms 17ms 20ms 2 10.32.216.1 (10.32.216.1) 19 ms 19 ms 19 ms 19ms 18ms 3 10.32.216.1 (10.32.216.1) 39 ms 19 ms 19 ms 25ms 19ms 4 10.32.136.23 (10.32.136.23) 19 ms 39 ms 39 ms 21ms 28ms 5 10.32.168.22 (10.32.168.22) 20 ms 39 ms 39 ms 27ms 30ms 6 10.32.197.4 (10.32.197.4) 59 ms 119 ms 39 ms 60ms 57ms 7 10.119.2.5 (10.119.2.5) 59 ms 59 ms 39 ms 60ms 45ms 8 10.140.70.13 (10.140.70.13) 80 ms 79 ms 99 ms 90ms 87ms 9 10.140.71.6 (10.140.71.6) 139 ms 139 ms 159 ms 120ms 160ms 10 10.140.81.7 (10.140.81.7) 199 ms 180 ms 300 ms 200ms 150ms 11 10.140.72.17 (10.140.72.17) 300 ms 239 ms 239 ms 350ms 200ms 12 * * * * * 13 10.121.54.72 (10.121.54.72) 259 ms 499 ms 279 ms 500ms 550ms 14 * * * * * 15 * * * * * 16 * * * * * 17 * * * * * 18 10.10.0.10 (10.10.0.10) 339 ms 279 ms 279 ms 600ms 592ms
Item |
Description |
---|---|
hops max |
Maximum TTL. |
packet length |
Length of the sent packet. |
1 10.3.112.1 (10.3.112.1) 17 ms 17 ms 27 ms 17ms 20ms |
"1" indicates the first-hop gateway. The sequence number increases by 1 each time the packet passes through one hop. "10.3.112.1" indicates the address of the first-hop gateway. The IPv4 address following the sequence number of each hop is the gateway address of that hop. "17 ms 17 ms 27 ms 17ms 20ms" indicates the time difference between when the five UDP packets are sent and when the corresponding ICMP Time Exceeded or ICMP Port Unreachable messages are received. |
12 * * * * * |
The response packet from the 12th-hop gateway times out. |
Example for Using the tracert ipv6 Command on an IPv6 Network
<HUAWEI> tracert ipv6 -q 5 -w 8000 2001:db8:100::3 traceroute to 2001:db8:100::3 30 hops max,60 bytes packet 1 2001:db8:200::2 26 ms 23 ms 26 ms 30 ms 29 ms 2 2001:db8:100::3 3020 ms 3024 ms 4040 ms 6820 ms 5584 ms
Item |
Definition |
---|---|
hops max |
Maximum hop limit. |
bytes packet |
Size of a trace packet. |
1 2001:db8:200::2 26 ms 23 ms 26 ms 30 ms 29 ms |
"1" indicates the first-hop gateway. "2001:db8:200::2" indicates the IPv6 address of the first-hop gateway. "26 ms 23 ms 26 ms 30 ms 29 ms" indicate the round-trip time (RTT) values of the packets. |