CAIDA / bgpstream

BGP measurement analysis for the masses
GNU General Public License v2.0
108 stars 42 forks source link

how to get updates from a specific AS #107

Open cherepanovic opened 4 years ago

cherepanovic commented 4 years ago

I am looking for the possibility to get updates from a specific AS not a collector. Is it possible?

thanks!

digizeph commented 4 years ago

@cherepanovic you can use filtering on AS path to filter updates with certain AS at the last hop (or in the middle, depending on your use case) on the path. https://github.com/CAIDA/libbgpstream/blob/master/FILTERING

If you could tell us a bit more about how you're using the bgpstream (e.g. bgpreader, or c api, or python api) and the version of bgpstream that you're using, we can further help you on this.

More tutorials can be found at https://bgpstream.caida.org/docs/tutorials (for version 2).

cherepanovic commented 4 years ago

I am using the python api.

pybgpstream 2.0.2
bgpreader version 2.0.0 

thanks in advance!

digizeph commented 4 years ago

@cherepanovic You can try something like the following:

import pybgpstream
stream = pybgpstream.BGPStream(
        from_time="2017-07-07 00:00:00", until_time="2017-07-07 00:10:00 UTC",
        collectors=["route-views.sg", "route-views.eqix"],
        record_type="updates",
        filter="aspath _15169$"
        )

for elem in stream:
    print(elem)

The relevant option is filter="aspath _15169$". It indicates that it should filter updates with the last hop of aspath to be 15169. _ indicates space, and $+*^ works the same as in regex. Similarly, the following filter would filter updates with AS15169 in the middle of the paths fitler="aspath _15169_".

Checkout the tutorials and FILTERING documentation for more examples.

Please let us know if this resolves your question.

cherepanovic commented 4 years ago

Thank you!

Similarly, the following filter would filter updates with 45528 in the middle of the paths fitler="aspath 15169".

what is 45528?

The last question is about ASs, is there a list where you can see which collectors listen to which ASs?

digizeph commented 4 years ago

Thank you!

Similarly, the following filter would filter updates with 45528 in the middle of the paths fitler="aspath 15169".

what is 45528?

Sorry, that was just a typo, I used AS15169 as an example. Updated my answer there.

The last question is about ASs, is there a list where you can see which collectors listen to which ASs?

If you mean the list of peers the collectors connect to, you can refer to the following resources: