What is the usage of traceroute in Linux?
The traceroute command in Linux is used to trace the path of data packets from the source to the destination. It works by sending specific ICMP echo requests (pings) to the target address and recording the routers each packet passes through. This helps determine latency and the route in the network.
The usage of the traceroute command is as follows:
traceroute [选项] 目标地址
Some common options include:
- Use ICMP Echo requests for tracing instead of UDP packets.
- – T: Trace using TCP SYN packets.
- Disable the resolution of IP addresses to hostnames in order to display IP addresses instead of hostnames.
- -Q: Specify the maximum number of transmissions for each Time To Live (TTL).
- -w: set the timeout for each reply.
For example, to track the path to the target address “example.com”, you can use the following command:
traceroute example.com
This command will display the path from the source host to the destination address, as well as the latency time for each node.