hadiasghari / pyasn

Python IP address to Autonomous System Number lookup module. (Supports fast local lookups, and historical lookups using archived BGP dumps.)
Other
294 stars 72 forks source link

Private IPs in database files #74

Open EugeniuZ opened 2 years ago

EugeniuZ commented 2 years ago

Hi,

Currently I see these entries in the database file:

; IP-ASN32-DAT file
; Original source: rib.20220413.1800.bz2
; Converted on  : Wed Apr 13 19:48:48 2022
; Prefixes-v4   : 963212
; Prefixes-v6   : 152468
...
192.168.1.0/24  141011
192.168.2.0/24  141011
192.168.3.0/24  141011
192.168.7.0/24  141011
...

Could you please clarify why are private IP ranges assigned an ASN?

EugeniuZ commented 2 years ago

At least it should not map to public ASNs.

hadiasghari commented 2 years ago

Hi @EugeniuZ ,

This isn't normally the case. It seems like an error with the MRT/RIB/BGP data. A simple fix would be to filter out these private ranges from the file. Where did you download your RIB file from?

EugeniuZ commented 2 years ago

Hi @hadiasghari ,

This is what I see in the log:

Finding most recent archive in /route-views4/bgpdata/2022.04/RIBS ...
Downloading ftp://archive.routeviews.org//route-views4/bgpdata/2022.04/RIBS/rib.20220414.0600.bz2

We're using the provided tool to download the database (pyasn_util_download.py --latestv46)

So is this the wrong place to report the issue?

hadiasghari commented 2 years ago

@EugeniuZ, I am not spending much time on this project at the moment, so I cannot unfortunately debug this issue at the moment. Basically, pyasn parses the RIB file information to produce its ipasn.dat file. The RIB file is a dump from a router's BGP table (in this case from route-views4 vantage). These private v4 addresses should not appear in the RIB files--and typically don't. Perhaps this is some temporary problem with this vantage point? I'd recommend downloading a couple of recent RIB files from other vantage points (you can find them via a search), and converting those too to see if the private IP range appear in them too. That should help narrow the problem cause.... I hope this helps.