Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use traceroute in Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use traceroute in Linux", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use traceroute in Linux" this article.

Through traceroute, we can know the path of information from your computer to the host on the other side of the Internet. Of course, each packet from the same starting point (source) to a certain same destination (destination) may take a different path, but basically, most of the time the route is the same.

In the Linux system, we call it tracertoute, and in MS Windows it is tracert.

Traceroute measures how long it takes to send a small packet to the destination device until it returns. The traceroute of each device on a path is tested 3 times. The output includes the time of each test (ms) and the name of the device and its IP address.

In most cases, we will execute the command line directly under the Linux host system.

Traceroute hostname

Under the Windows system, the command of tracert is executed:

Tracert hostname

1. Command format:

Traceroute [parameters] [host]

two。 Command function:

The traceroute command allows you to track the routing path of network packets. The default packet size is 40 Bytes, which the user can set separately.

Specific parameter format: traceroute [- dFlnrvx] [- f] [- g] [- I] [- m] [- p] [- s] [- t] [- w] [host name or IP address] [packet size]

3. Command parameter

-d uses socket-level troubleshooting capabilities

-f sets the size of TTL, the survival value of the first detection packet

-F set not to leave the Rank-I don't know what the Rank is. I checked and didn't find any information.

-g set source routing gateways. You can set up to 8.

-I send packets using the specified network interface

-I use ICMP responses instead of UDP data information

-m sets the size of the maximum survival value TTL of the detection packet

-n directly use the IP address instead of the host name

-p sets the communication port of the UDP transport protocol

-r ignore the normal routing table and send the packet directly to the remote host

-s sets the IP address of the packet sent by the local host

-t sets the TOS value of the inspection packet

-v shows the execution of the instruction in detail

-w sets the time to wait for the remote host to report back

-x check the correctness of turning on or off packets

4. Return result explanation:

By default, the maximum value of TTL is 30, which can be changed according to the actual situation, and 3 probes (each with different TTL values) are sent to each hop.

Return result explanation:

* the probe message did not get a response. In this case, the firewall may have blocked the return information of ICMP, so we can not get any relevant data packets.

! The TTL value in the received message is 1

! h the target host is unreachable

! n the target network is unreachable

! P the target protocol is unreachable

! s source routing option error, indicating that a router has a program error or hardware failure

! F probe message needs to be segmented, indicating that a router has a program error or hardware failure

! X the path is blocked or closed because communication is administratively prohibited

Sometimes we have a long delay at a gateway, which may be due to the congestion of a gateway or the physical device itself. of course, if there is a problem with a DNS, there will be a long delay when the host name and domain name cannot be resolved. You can add the-n parameter to avoid DNS parsing and output data in IP format.

five. Application of traceroute Command option

When the number of routes between the network of the target host and the network of the local machine is more than 30, modify the value of TTL

# traceroute-m 35 128.197.2.200

By default, probe messages are sent based on the UDP protocol, but some routers in the network do not support it. The-I parameter indicates that the ICMP protocol is used instead.

# traceroute-m 35-I 128.197.2.200

By default, port 33434 of the UDP protocol is tracked, and-p specifies the port number

# traceroute-m 35-p 65000 128.197.2.200

-v is used to display the size and target of the response message for each hop

-n is used to display addresses instead of using consistent name displays to reduce the load on network services (speed up)

6.TTL

Although TTL literally translates as the time it takes to survive, in fact TTL is the maximum number of hops that IP packets can forward in a computer network. The TTL field is set by the sender of the IP packet, and the router modifies the value of the TTL field each time a router passes through the entire forwarding path of the IP packet from source to destination, by subtracting the value of the TTL by 1, and then forwarding the IP packet. If the TTL is reduced to 0 before the IP packet reaches the destination IP, the router discards the received TTL=0 IP packet and sends an ICMP time exceeded message to the sender of the IP packet.

The above is all the contents of the article "how to use traceroute in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report