The tracert command checks the path of packets from the source to the destination, checks network connectivity, and locates a network fault.
tracert [ -a source-ip-address | -f first-ttl | -m max-ttl | -name | -p port | -q nqueries | -v | -vpn-instance vpn-instance-name [ pipe ] | -w timeout | -s packetsize ] * host
Only S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support -v.
Parameter | Description | Value |
---|---|---|
-a source-ip-address |
Specifies the source address of a probe packet. If this parameter is not specified, the IP address of the outbound interface is used as the source IP address for sending tracert packets. |
The value is in dotted decimal notation. |
-f first-ttl |
Specifies the initial TTL. The TTL field is carried in the IP header. It indicates the lifetime of packets and specifies the maximum hops that packets can pass through. The TTL value is set on the source and reduced by 1 each time the packet passes through a hop. When the TTL value is reduced to 0, the packet is discarded. At the same time, an ICMP Timeout message is sent to notify the source host. If first-ttl is specified and the number of hops is smaller than the value of first-ttl, no ICMP Timeout packet is sent to the source host when the packet passes through these hops. If max-ttl is specified, the value of first-ttl must be smaller than the value of max-ttl. |
The value is an integer that ranges from 1 to 255. The default value is 1. |
-m max-ttl |
Specifies the maximum TTL. Usually, the maximum TTL is set to the number of hops the packet passes through. You need to use this parameter to change the TTL. If first-ttl is specified, the value of max-ttl must be greater than the value of first-ttl. |
The value is an integer that ranges from 1 to 255. The default value is 30. |
-name |
Displays the host name of each hop. |
- |
-p port |
Specifies the UDP port number of the destination. Before specifying the UDP port number of the destination, ensure that the port is not in use; otherwise, the tracert fails. |
The value is an integer that ranges from 0 to 65535. The default value is 33434. |
-q nqueries |
Specifies the number of probe packets to be sent each time. In the case of poor network quality, you can set this parameter to a comparatively large value to ensure that the probe packet can reach the destination. |
The value is an integer that ranges from 1 to 65535. The default value is 3. |
-v |
Displays the MPLS label carried in the ICMP Time Exceeded packet. |
By default, the MPLS label carried in the ICMP Time Exceeded is not displayed. Instead, only the path information carried in the ICMP Time Exceeded and Port-Unreachable packets is displayed. |
-vpn-instance vpn-instance-name |
Specifies the name of the VPN instance to which the destination address belongs. |
The value must be an existing VPN instance name. |
pipe |
Specifies the pipe mode. When a probe packet passes through the MPLS domain, the entire MPLS domain is considered as one hop and the IP TTL of the probe packet is reduced by one on the ingress node and egress node respectively. |
- |
-w timeout |
Specifies the timeout period to wait for a reply. If a tracert packet times out when reaching a gateway, an asterisk (*) is displayed. In the case of poor network quality and a low network transmission rate, you are advised to prolong the timeout period. |
The value is an integer that ranges from 0 to 65535, in milliseconds. The default value is 5000. |
-s packetsize |
Specifies the length of an ICMP Echo Request message, excluding the IP header and ICMP header. |
The value is an integer that ranges from 12 to 9600, in bytes. The default value is 12. |
host |
Indicates the domain name or IPv4 address of the destination host. |
The value is a string of 1 to 255 case-sensitive characters with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. Alternatively, the value can be a valid IPv4 address in dotted decimal notation. |
Usage Scenario
During routine system maintenance, you can run the ping command to check network connectivity. If the ping fails, run the tracert command to locate the fault on the network.
You can specify different parameters in the tracert command for different scenarios:
Prerequisite
Procedure
When receiving a packet, each destination hop cannot find the port specified in the packet, and returns an ICMP Port Unreachable message, indicating that the destination port is unreachable and the tracert ends. In this manner, the result of each probe is displayed on the source, according to which you can find the path from the source to the destination.
Configuration Impact
Precautions
Once -r is specified, the outputs of both the tracert and ping commands show information about nodes between the source and the destination. Differences between the outputs of the tracert and ping commands are as follows:
By default, each hop sends three probe packets. If load balancing is implemented, the same hop may correspond to different nodes. In this case, if the IP address in a probe packet is different from that in the previous probe packet, information in the later probe packet is displayed. If the IP address in a probe packet is the same as that in the previous probe packet, information in the previous probe packet is displayed.
# Tracert the gateways from the source host to the destination host with the IP address being 10.1.1.11.
<HUAWEI> tracert 10.1.1.11
traceroute to 10.1.1.11 (10.1.1.11), max hops: 30, packet length: 40, press CTRL_C to break
1 10.3.112.1 10 ms 10 ms 10 ms
2 10.32.216.1 19 ms 19 ms 19 ms
3 * * *
4 * * *
5 * * *
6 * * *
7 10.1.1.11 339 ms 279 ms 279 ms
Item |
Description |
---|---|
traceroute to |
Tracert to a destination IP address. |
max hops |
Maximum TTL value. |
packet length |
Length of a sent packet. |
1 10.3.112.1 10 ms 10 ms 10 ms |
The integer 1 indicates the first hop gateway. Each hop increments the hop count. By default, the maximum hop count is 30. "10.3.112.1" is the gateway address of the first hop. The IPv4 address following the serial number of each hop is the gateway address of the hop. "10 ms 10 ms 10 ms" indicates the difference between the time when the three UDP packets are sent and when corresponding ICMP Time Exceeded or ICMP Port Unreachable messages are received. |
* * * |
No ICMP Time Exceeded message or ICMP Port Unreachable message is returned within a specified period on the Nth hop. By default, an ICMP Time Exceeded message or ICMP Port-unreachable message should be returned within 5000 ms. |