Published on

traceroute command-trace the entire path of a data packet during transmission on the network



2 min read

The traceroute command is used to trace the entire path of a data packet when it is transmitted on the network. The default data packet size it sends is 40 bytes. Through traceroute, we can know the path taken by the information from your computer to the host on the other end of the Internet. Of course, the path taken by a data packet from the same starting point (source) to the same destination (destination) may be different, but basically the route taken is the same most of the time.

Traceroute measures how long it takes by sending small packets to the destination device until it returns. Traceroute for each device on a path needs to be tested 3 times. The output results include the time (ms) of each test and the name of the device (if any) and its ip address.

Syntax: traceroute [parameter] [domain name or IP]

Command parameters
-dUse Socket-level troubleshooting
-f<survival value>Set the size of the survival value TTL of the first detection packet
-FSet do not leave the break position
-g<gateway>Set source routing gateway, up to 8 can be set
-i<network interface>Send data packets using the specified network interface
-IUse ICMP response to replace UDP data information
-m<survival value>Set the size of the maximum survival value TTL of the detection packet
-nUse IP address directly instead of host name
-p<communication port>Set the communication port of UDP transmission protocol
-rIgnore the ordinary Routing Table and send the data packet directly to the remote host
-s<source address>Set the IP address of the data packet sent by the local host
-t<service type>Set the TOS value of the detection packet
-vDetailed display of the execution process of instructions
-wSet the time to wait for the remote host to report back
-xTurn on or off the correctness of data packets

Trace the transmission path of local data packets to

[root@linuxstar ~]# traceroute

Hop count setting:

[root@linuxstar ~]# traceroute -m 7

Display the IP address without checking the host name:

[root@linuxstar ~]# traceroute -n

Set the number of detection packets to the value 4:

[root@linuxstar ~]# traceroute -q 4

Set the waiting response time for outgoing detection packets to 3 seconds:

[root@linuxstar ~]# traceroute -w 3