- Published on
traceroute command-trace the entire path of a data packet during transmission on the network
Jonas
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
-d | Use Socket-level troubleshooting |
-f<survival value> | Set the size of the survival value TTL of the first detection packet |
-F | Set 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 |
-I | Use ICMP response to replace UDP data information |
-m<survival value> | Set the size of the maximum survival value TTL of the detection packet |
-n | Use IP address directly instead of host name |
-p<communication port> | Set the communication port of UDP transmission protocol |
-r | Ignore 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 |
-v | Detailed display of the execution process of instructions |
-w | Set the time to wait for the remote host to report back |
-x | Turn on or off the correctness of data packets |
Example
Trace the transmission path of local data packets to www.linuxprobe.com:
[root@linuxstar ~]# traceroute www.linuxprobe.com
Hop count setting:
[root@linuxstar ~]# traceroute -m 7 www.linuxprobe.com
Display the IP address without checking the host name:
[root@linuxstar ~]# traceroute -n www.linuxprobe.com
Set the number of detection packets to the value 4:
[root@linuxstar ~]# traceroute -q 4 www.linuxprobe.com
Set the waiting response time for outgoing detection packets to 3 seconds:
[root@linuxstar ~]# traceroute -w 3 www.linuxprobe.com