tracert

Function

The tracert command enables the system to trace the gateways that packets pass through from the source to the destination.

Format

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

Parameters

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.

  • If no UDP port number is specified, when you run the tracert command, a port with the port number greater than 32768 is randomly chosen for the destination to receive trace packets.
  • Before specifying the UDP port number for the destination, ensure that the port is not in use; otherwise, the trace test fails.

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.

  • The specified next hop address must be the next hop address of a directly connected physical interface.
  • When you specify a next hop address, you can configure -i interface-type interface-number to specify an outbound interface. The following conditions must be met to ensure a test success:
  • The specified next hop address must match the outbound interface.
  • The specified outbound interface cannot be a logical interface's member interface.
  • If you have specified a next hop address, you cannot specify a VPN.
-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.

Views

All views

Default Level

0: Visit level

Task Name and Operations

Task Name Operations
tailmode2 execute

Usage Guidelines

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:

  • To view information about nodes between the source and the destination, run the tracert host command.
  • To view information about nodes between the source and the destination on a network of poor qualities, run the tracert -q nqueries -w timeout host command. In the case of an unreliable network, you are advised to set -q and -w to larger values so as to obtain accurate information.
  • To detect the nodes along a certain segment of a path, run the tracert -f initTtl -m maxTtl host command with the specified initial TTL and the maximum TTL.
  • To check information about nodes between the source and the destination on an L3VPN, run the tracert -vpn-instance command. On a Layer 3 VPN, devices may not have route information of each other. Therefore, the tracert host command cannot be directly used to check the connectivity between the devices. The peer end can be reached only through the VPN. To view information about nodes between the source and the destination in a specified VPN instance, run the tracert -vpn-instance command.
  • To view information about nodes between the source and the destination host based on packet forwarding without searching for the routing table, run the tracert -nexthop nexthop-address -passroute -i interface-type interface-number command with specified next-hop address and packet outbound interface.

Prerequisites

  • Before running the tracert command, ensure that the UDP module of each node works properly. Otherwise, the tracert operation fails.
  • If vpn-instance is configured, ensure that the VPN module of each node works properly.
  • Ensure that the ICMP module of each node works properly; otherwise, a time-out packet will be sent to the source.

Implementation Procedure

The process of the tracert command is as follows:

  • The source host sends a packet with the TTL being 1. After the TTL times out, the first hop sends an ICMP Error message to the source host, indicating that the packet cannot be forwarded.
  • The source host sends a packet with the TTL being 2. After the TTL times out, the second hop sends an ICMP Error message to the source host, indicating that the packet cannot be forwarded.
  • The source host sends a packet with the TTL being 3. After the TTL times out, the third hop sends an ICMP Error message to the source host, indicating that the packet cannot be forwarded.
  • The preceding process repeats until the packet reaches the destination.

    After the destination device of each hop receives the IPv4 packet, the destination device sends an ICMP Port Unreachable message to the source device because the port specified in the packet is not applied to the destination device. This message indicates that the destination port is unreachable and the tracert command is executed. In the command output of the source device, you can view the path that the packet passes through.

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.

Example

# Trace the gateways from the source to the destination at 10.10.1.1 on a specified L3VPN.
<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
# Trace the gateways from the source to the destination at 10.10.0.10. Configure the test packets to be sent for five times 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
# Trace the gateways from the source to the destination at 192.168.5.115.
<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
# Trace the AS number from the source to the destination at 10.4.4.4.
<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
# Tracert the ip address192.168.3.9.
<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
# Perform reverse domain name parsing to convert the IP address into a domain name.
<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
# Perform forward domain name parsing to convert the domain name into an IP address.
<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
Table 1 Description of the tracert command output
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
  • 1 indicates the first hop gateway. Each hop increments the hop count. By default, the maximum number of hops is 30.
  • x.x.x.x indicates the gateway address of the first hop. The IPv4 address following the sequence number of each hop is the gateway address of the hop.
  • a ms b ms c ms indicates the difference between the time when three UDP packets are sent and the time when ICMP Time Exceeded or ICMP Port Unreachable messages are received. By default, each hop sends three UDP probe packets.
*

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.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >