Kitz Forum

Chat => Tech Chat => Topic started by: Weaver on January 25, 2020, 10:23:51 AM

Title: Traceroute
Post by: Weaver on January 25, 2020, 10:23:51 AM
Is it possible to write a parallel traceroute ? One where the pings to the nth hops are fired out at the same time? Or with a tiny inter-delay in case one overflows some buffer capacity somewhere.
Title: Re: Traceroute
Post by: niemand on January 25, 2020, 11:56:34 AM
Yes. Coding mostly already done with the 'flood' option on ping. No reason it couldn't be amended to do the same for traceroute beyond that you need to wait to receive the TTL expired messages else you're going to be sending a bunch of packets extra as your end destination won't have had time to respond before you've already sent loads of packets with higher TTLs out, all of which the end device will be responding to.

The basic logic of it is:

Send packet addressed to X with TTL 1
Receive TTL expired ICMP message
Increment TTL
Send packet addressed to X with new TTL
Receive TTL expired ICMP message
Repeat until response comes back from X

You could certainly use the equivalent of the ping 'flood' option code which means 'send packets as fast as the network stack will allow'.

This is not parallel, however it's close enough. The tiny inter-delay you refer to would be created through the serialisation of packets going via the kernel's network stack and would take care of itself.
Title: Re: Traceroute
Post by: ejs on January 25, 2020, 12:39:04 PM
The standard traceroute program found in Linux distributions does send out multiple probe packets simultaneously (by default).

Quote from: traceroute(8)
-N squeries, --sim-queries=squeries
       Specifies the number of probe packets sent  out  simultaneously.
       Sending several probes concurrently can speed up traceroute
       considerably. The default value is 16.
       Note that some routers and hosts can use ICMP  rate  throttling.
       In such a situation specifying too large number can lead to loss
       of some responses.