The tracert command enables the system to trace the gateways that packets pass through from the source to the destination.
tracert [ -a source-ip-address | -f initTtl | -m maxTtl | -p destPort | -q nqueries | { -vpn-instance vpn-instance-name | -as } | -w timeout | -v | -s size | -i { interface-name | interface-type interface-number } | -name | { -tos tos-value | -dscp dscp } | -nexthop nexthop-address | -passroute | -service-class classValue ] * host
tracert [ -a source-ip-address | -f initTtl | -m maxTtl | -p destPort | -q nqueries | { -vpn-instance vpn-instance-name [ peer peerIpv6 ] } | -w timeout | -v | -s size | -i { interface-name | interface-type interface-number } | -name | { -tos tos-value | -dscp dscp } | -nexthop nexthop-address | -passroute ] * host
Parameter | Description | Value |
---|---|---|
-a source-ip-address |
Specifies the source address of trace packets. The source IP address is the IP address of the local interface. |
The value is in dotted decimal notation. |
-f initTtl |
Specifies the initial time to live (TTL). Carried in the IP header, the TTL field indicates the lifetime of the IP 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. At the same time, an ICMP Timeout packet is sent to the source. If initTtl is specified and the number of hops is smaller than the specified value, the TTL value will be greater than 0 after the packet passes through all the nodes. Therefore, no ICMP timeout packet is sent to the source.If maxTtl is specified, the value of initTtl must be smaller than or equal to the value of maxTtl. |
The value is an integer ranging from 1 to 255. The default value is 1. |
-m maxTtl |
Specifies the maximum TTL. Generally, 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 initTtl is specified, the value of maxTtl must be greater than or equal to the value of initTtl. |
The value is an integer ranging from 1 to 255. The default value is 30. |
-p destPort |
Specifies the UDP port number of the destination.
|
The value is an integer ranging from 0 to 65535. The default value is 33434. |
-q nqueries |
Specifies the number of test packets sent in a trace test. In the case of poor network qualities, you can set this parameter to a comparatively larger value to ensure that a test packet can reach the destination. |
The value is an integer ranging from 1 to 65535. The default value is 3. |
-vpn-instance vpn-instance-name |
Specifies the name of the VPN instance to which the destination address belongs. |
The value is a string of 1 to 31 case-sensitive characters, spaces not supported. In addition, the VPN instance name must not be _public_. When double quotation marks are used around the string, spaces are allowed in the string. |
-w timeout |
Specifies the period of time for waiting for a response. If a test packet reaches a gateway and times out, "*" is displayed. In the case of poor network qualities and a low network transmission rate, you are advised to prolong the timeout period. |
The value is an integer ranging from 0 to 3600000, in milliseconds. The default value is 5000. |
-v |
Displays the verbose information, including the MPLS label information. |
- |
-name |
Displays the host name of the destination address. |
- |
-s size |
Specifies the packet size. |
It is an integer ranging from 12 to 9600. |
-i interface-name |
Sets the interface name for sending UDP messages. |
- |
interface-type |
Sets the interface type for sending UDP messages. |
- |
interface-number |
Sets the interface number for sending UDP messages. |
- |
-tos tos-value |
Specifies the ToS value of packets sent. By specifying this parameter, you can set the DSCP value and IP priority for packets. |
The value is an integer ranging from 0 to 255. The default value is 0. |
-dscp dscp |
Specifies a DSCP value for ICMP Echo Request packets to be sent. |
The value is an integer in the range from 0 to 63. The default value is <b>0</b>. |
-nexthop nexthop-address |
Specifies an IP address for the next hop. If you have specified this parameter, the device no longer searches the routing table before sending UDP packets. |
The value is in dotted decimal notation.
|
-passroute |
Sends UDP packets without searching for the routing table. If you specify -passroute, specify -nexthop nexthop-address and -i interface-type interface-number at the same time. Otherwise, the test fails. |
- |
host |
Specifies the name or the IP address of the destination host. |
The value is a string of 1 to 255 characters. If the parameter value is an IP address, set the format of the parameter to dotted decimal notation. |
-as |
Displays the AS number for each hop. If the -as keyword is configured, the AS number of each hop is obtained by querying the local routing table based on the response address. The AS number is displayed only when the corresponding routing entry is learned through BGP and the BGP route carries the AS number. |
- |
-service-class classValue |
In an SRv6 TE Policy group scenario, you can specify this parameter to select a path. |
The value is of the enumerated type and can be be, af1, af2, af3, af4, ef, cs6, or cs7. |
peer peerIpv6 |
Specifies a peer SID, that is, the address of the last hop in the SRv6 domain, in EVPN L3VPN over SRv6 BE scenarios. |
The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
Usage Scenario
The ping command is used to check the connectivity of the network, and the tracert command is used to locate the faulty node.
In different test scenarios, parameters specified in the tracert command are different:Prerequisites
Implementation Procedure
The process of the tracert command is as follows:
Precautions
Both the tracert command and the ping command with the -r parameter configured return information about the nodes between the source and the destination. Differences between the two commands are as follows:
If the ping command times out on a transit node, the ping test times out and no path information is displayed.
If the tracert command times out on a transit node, "* * *" is displayed for the node. This does not affect the tracert command execution.
In the result displayed on the source end, the IP address carried in the tracert response packet is not the IP address of the packet ingress, but the smallest IP address in the VPN.In an SRv6 TE flow group scenario where routes are recursed based on DSCP values, if the -service-class keyword is specified, the tunnel fails to be established.
<HUAWEI> tracert -name -f 2 -m 64 -s 100 10.10.1.1
traceroute to 10.10.1.1(tcore1.as1.net), hops max: 64, packet length: 100,press CTRL_C to break
1 10.1.1.1 (tcore1.as6.net) 19 ms 23 ms 20 ms
2 10.1.2.1 (tcore1.as6453.net) 19 ms 25 ms 30 ms
3 * * *
4 10.1.3.1 (tcore1.as63454.net) 259 ms 499 ms 279 ms
5 * * *
6 10.10.1.1 (tcore1.as1.net) 339 ms 279 ms 279 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
<HUAWEI> tracert -vpn-instance abc 192.168.5.115
traceroute to 192.168.5.115 (192.168.5.115), hops max: 30, packet length: 40,press CTRL_C to break
1 10.3.112.1 (10.3.112.1) 17 ms 17 ms 27 ms
2 10.32.216.1 (10.32.216.1) 19 ms 19 ms 19 ms
3 * * *
4 10.121.54.72 (10.121.54.72) 259 ms 499 ms 279 ms
5 * * *
6 192.168.5.115 (192.168.5.115) 339 ms 279 ms 279 ms
<HUAWEI> tracert -as 10.4.4.4
traceroute to 10.4.4.4(10.4.4.4), max hops: 30, packet length: 40, press CTRL_C to break
1 10.1.1.2 5 ms 2 ms 2 ms
2 10.3.1.2<AS=300> 5 ms 3 ms 3 ms
3 10.4.4.4<AS=400> 5 ms 3 ms 3 ms
<HUAWEI> tracert -v 192.168.3.9
traceroute to 192.168.3.9(192.168.3.9), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.1.2[MPLS Label=4187 Exp=0 S=1 TTL=1] 5 ms 1 ms 1 ms
2 10.2.1.2 9 ms 2 ms 2 ms
<HUAWEI> tracert -name 192.168.10.2
traceroute to 192.168.10.2(www.huawei.com), max hops: 30 ,packet length: 40,press CTRL_C to break
1 192.168.10.2(www.huawei.com) 9 ms 1 ms 15 ms
<HUAWEI> tracert www.huawei.com
traceroute to 192.168.10.2(www.huawei.com), max hops: 30 ,packet length: 40,press CTRL_C to break
1 192.168.10.2 7 ms 2 ms 12 ms
Item | Description |
---|---|
traceroute to x.x.x.x | Specifies the destination IP address. |
hops max: x | Specifies the maximum TTL. |
packet length: x | Specifies the size of a test packet. |
1 x.x.x.x a ms b ms c ms |
|
* | Response packet timed out. |
x | Specifies the TTL value. |
x.x.x.x | Specifies the address of a reply. |
x ms | Round-Trip Time (RTT) value. |
MPLS Label | Indicates the value of the MPLS label. |
Exp | Indicates the EXP value. |
TTL | Indicates the TTL value. |