Novice networker here.

I can't seem to find any straightforward answers online.


  IP             SUBNET           NEXT HOP
>    R1
>    R1
>      R2
>    R4
>    R4
>    R3
>    R4
>    R4

What is the proper method to aggregate these entries into the minimum number of entries?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Jan 5, 2021 at 2:31

2 Answers 2


First, separate the entries by next hop. You have to summarize them separately:

IP             SUBNET           NEXT HOP    R1    R1      R2    R3    R4    R4    R4    R4

Then for each next next hop, convert all the network addresses to binary. Here is just the first one:

10000001.00001010.01110000.00000000 = 
10000001.00001010.01010000.00000000 =

Now find all the identical digits, starting from the left. In this case, the digits are all the same up to the 18th position. So your new mask is /18. Now, using either address and the /18 mask, find the network address by ANDing the address and the mask:

10000001.00001010.01110000.00000000 =
11111111.11111111.11000000.00000000 = /18 (
10000001.00001010.01000000.00000000 = /18

So the best summarization of the first two routes is

(the rest is left as a exercise for the reader)


There is tool Aggregate from ISC.

I have dump with Google IPs (6760 subnets)

$ cat google-ip | wc -l
$ head google-ip

Usage of aggregate

$ aggregate < google-ip > google-ip-agged
$ cat google-ip-agged | wc -l
$ head google-ip-agged

My big dump aggregated to only 58 subnets.

I used aur/aggregate from Archlinux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.