Understanding Range Aggregation in IPinfo's IP Databases

You will often see that the number of ranges of an ASN you obtain through IPinfo WHOIS records, IP to Company Database or our ASN API does not match with the number of ranges in the ASN database or the free IP to ASN database. The database often returns fewer ranges than expected. So why is that?

Understanding range aggregation

Range aggregation is a technique that reduces the number of neighboring ranges with respect to the corresponding IP metadata. Range aggregations aggregate neighboring ranges/CIDRs into a bigger range. This feature is available in your CLI as well.

IP range aggregation refers to the process of grouping contiguous/neighbouring IP address ranges into a more simplified or larger block, expressed in CIDR notation. This aggregation reduces the complexity of managing and processing multiple smaller ranges of IP addresses, making it easier to handle routing tables, firewall rules, or data storage.

Example

We are going to evaluate AS44534 to understand range aggregation. The ranges are available to the public through our website.

msedge_I6rTVjaVCy

And the ranges can also be accessed with our ASN API.

https://ipinfo.io/AS13238?token=$token

WindowsTerminal_KIOYwckpjb

I will extract the IPv4 ranges of the ASN using JQ.

ipinfo → ~ $ curl -s https://ipinfo.io/AS44534?token=$token | jq .prefixes[].netblock
"178.154.152.0/24"
"37.140.168.0/24"
"5.255.232.0/24"
"5.45.209.0/24"
"87.250.232.0/24"
"87.250.238.0/24"
"90.156.176.0/24"
"90.156.177.0/24"
"90.156.182.0/24"
"90.156.184.0/24"
"90.156.186.0/24"
"95.108.168.0/22"

ipinfo → ~ $ curl -s https://ipinfo.io/AS44534?token=$token | jq .prefixes[].netblock | wc -l
12

According to our ASN API, AS44534 operates 12 unique IPv4 ranges.

Now, we can use our free IP to Country ASN database hosted on Snowflake for this. We will use the range_to_cidr command to get the IPv4 CIDRs of AS44534.

SELECT
  flat_data.value as IP_RANGE,
  FROM (
    SELECT ipinfo.public.range_to_cidr(start_ip, end_ip) as ip_range, *
        FROM ipinfo.public.countr_asn
        WHERE asn='AS44534'
        AND start_ip like '%.%'
    ) as_ips,
TABLE(FLATTEN(as_ips.ip_range)) flat_data

We can see that the results show 11 IPv4 ranges. So, what happened to the missing range?

Let’s put the ASN API data and the IP to Country ASN data side by side.

Here we can see that the ASN API returned 90.156.176.0/24 and 90.156.177.0/24, which are missing from the ASN database response. Instead, it returns 90.156.176.0/23.

That is because these two /24 ranges are neighboring and have the same corresponding IP metadata. Therefore, we can reliably aggregate them into a larger /23 range without affecting the IP metadata.

We can confirm the range aggregation using our IPinfo CLI’s aggregate command.

$ ipinfo tool aggregate 90.156.176.0/24 90.156.177.0/24
90.156.176.0/23

What happens when the corresponding IP metadata is not the same?

If the IP metadata of these ranges is the same, range aggregation can work. However, if the corresponding range’s IP metadata is unique, it cannot be aggregated.

For example, the IP to Company database returns 43 IPv4 ranges for AS44534 because these ranges cannot be reliably aggregated into a larger range, as the neighboring ranges have different IP metadata.

But on the ASN database, the IPv4 range is 11, as it respects the corresponding IP metadata, allowing for the highest level aggregation possible.

Looking for individual range level information

If you want individual, detailed information on ASN ranges, you can use the ASN API or the IPinfo WHOIS database for that.