Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPinfo CLI tool command → aggregate closer inspection of operation recommended #200

Closed
abdullahdevrel opened this issue Dec 26, 2023 · 1 comment

Comments

@abdullahdevrel
Copy link
Contributor

The original intention of the aggregate function was to:

  • Accept IPv6 aggregation that firehole/iprange does not support
  • Introducting the range aggregation abilities within the IPinfo CLI ecosystem.

aggregate6 is a tool written in Python that provides IPv4 + IPv6 range aggregation.


System:

  • OS: Mac OS
  • CLI Version: 3.2.0

I am using the IPinfo CLI's aggregate command on an IP range filtered from the IP to Country ASN database.

anyfactor@ipinfo cli_test % wc -l sg_ips_country_asn.txt
  147081 sg_ips_country_asn.txt

anyfactor@ipinfo cli_test % ipinfo tool aggregate sg_ips_country_asn.txt > sg_ranges_country_asn.txt
anyfactor@ipinfo cli_test % wc -l sg_ranges_country_asn.txt
  147081 sg_ranges_country_asn.txt

The line count is identical. The aggregated count should be lower [1].

Using the aggregate6 tool

anyfactor@ipinfo cli_test % cat sg_ips_country_asn.txt | aggregate6 > sg_ranges_country_asn_aggregate6.txt
anyfactor@ipinfo cli_test % wc -l sg_ranges_country_asn_aggregate6.txt
  144841 sg_ranges_country_asn_aggregate6.txt

The aggregrate6 tool's output matches the expected [2] IP range row count derived from the filtered IP to Country database:

anyfactor@ipinfo cli_test % wc -l sg_ranges.txt
  144841 sg_ranges.txt

Notes:

[1] If the user extracts the IP address range using the "lowest denominating condition" of the IP metadata information, they are already getting an aggregated version of the IP address ranges.

Example:

a. The IP ranges of an individual country derived from the IP to Country database

This is a "lowest denominating condition" within the context of the IP to Country database, which means that the IP ranges for this database are aggregated based on individual countries. So, aggregating the IP addresses will not yield a different result than filtering the database based on a single country.

b. IP address ranges of a specific continent derived from the IP to Country database

This is not the lowest denominating condition within the context of the IP to Country database, which means that the IP database is aggregated based on individual countries and not continents. IP ranges of multiple countries can be aggregated into larger ranges.

c. The IP ranges of an individual country derived from the IP to Country ASN database

This is not the lowest denominating condition within the context of the context of this database, as the ranges could be divided into different AS-owned ranges within the country. The filtered IP address ranges could be aggregated.

d. The IP ranges of multiple countries derived from the IP to Country database

Any condition that includes multiple mutually non-exclusive categories will not be the lowest denominating condition, and the ranges can be aggregated.

For IP geolocation databases, the lowest denomination condition column is geoname_id.

For our other IP databases, the lowest denomination condition combines multiple mutually exclusive categories.

[2] What I am doing here.

sg_ips_country_asn → Singaporean IP CIDR ranges extracted from the IP to Country ASN

sg_ranges_country_asn.txt → The IPinfo CLI aggregated form of sg_ips_country_asn

sg_ranges_country_asn_aggregate6.txt → The aggregate6 aggregated form of sg_ips_country_asn

sg_ranges.txt → Singaporean IP CIDR ranges extracted from the IP to Country (Already aggregated from the production database)

The sg_ranges.txt file extracts the Singaporean IP address ranges from the IP to Country database. This respects the idea of "lowest denominating condition" and thus, the IP ranges listed are in their highest aggregated form possible.

The line count of sg_ranges_country_asn_aggregate6.txt matches the line count of sg_ranges.txt which indicates the aggregate6's IP aggregation is fully functional. On the other hand, sg_ranges_country_asn.txt does not match the line count of sg_ranges.txt which indicates the IP aggregation may not be functional in the IPinfo CLI tool.

@Taimoor-12
Copy link
Contributor

The latest version has been released that addresses the issue with range aggregation. We will add support for IPv6 soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants