fujiapple852 / trippy

A network diagnostic tool
https://trippy.cli.rs
Apache License 2.0
3.54k stars 76 forks source link

Group flows by AS CIDR prefix #1230

Open fujiapple852 opened 2 months ago

fujiapple852 commented 2 months ago

With ECMP routing we get multiple paths

Consider a path from A to C via Bn:

A > B1 > C
A > B2 > C
A > B3 > C

With ECMP, typically these Bn hops will share an AS with a given CIDR prefix. Consider the following Bn hop from a trace for AS13335 (CLOUDFLARENET, US) which has CIDR prefix 141.101.71.0/24:

AS13335 141.101.71.97 [11.8%]
AS13335 141.101.71.95 [8.8%]
AS13335 141.101.71.47 [17.6%]
AS13335 141.101.71.93 [11.8%]
AS13335 141.101.71.91 [8.8%]
AS13335 141.101.71.63 [14.7%] 
AS13335 141.101.71.2 [5.9%]
AS13335 141.101.71.105 [8.8%]
AS13335 141.101.71.107 [5.9%]

Today, when calculating flows, Trippy treat each Bn as independent and thus separate flows. This is problematic when there are several hops with ECMP (as is typical in large cloud and CDN providers) as the combination of possible paths becomes very large. i.e. consider a path with 5 hops, 3 of which have 10 ECMP paths (i.e. A > B(n) -> C(n) -> D(n) -> E where N is 10).

In such cases it may be useful to allow flows to be combined based on the AS CIDR prefix.