A simple command-line tracert implementation in Python 3 using ICMP packets
![](https://www.deeplearningdaily.com/wp-content/uploads/2021/07/a-simple-command-line-tracert-implementation-in-python-3-using-icmp-packets_60e383655e064-375x210.jpeg)
Traceroute
A simple command-line tracert implementation in Python 3 using ICMP packets
Details
Traceroute is a networking tool designed for tracing the movement of packets across a network. In this Python 3 implementation, ICMP ‘ping’ packets are used, much like the Windows tracert.exe
program (and unlike Unix tracert
which typically uses UDP packets).
The application sends a sequence of ICMP packets to the host, initially with the Time-To-Live field set to 1
. As the packet travels across the network to its final destination, each node it passes through will decrement the TTL field by 1
. When the field reaches zero the node will respond by saying that the packet could not reach its destination.
+------+ +--------+
| | TTL = 1