subnet aggregation script
Joe Abley
jabley at hopcount.ca
Mon Sep 21 16:29:19 UTC 2009
On 2009-09-21, at 12:00, Ric Moseley wrote:
> Does anyone know of a tool/script that can aggregate subnets feed to
> it
> via command line? Meaning if I give it multiple /30s (or any size
> subnet) it will scrunch them together.
I wrote this years ago and we used it in 6461 for various things.
ftp://ftp.isc.org/isc/aggregate/aggregate-1.6.tar.gz
> Example:
>
> #aggregate_subnets.script 192.168.0.0/30 192.168.0.4/30 10.0.0.16/29
> 10.0.0.24/29
>
> #192.168.0.0/29 10.0.0.16/28
[octopus:~]% cat >input-file
192.168.0.0/30
192.168.0.4/30
10.0.0.16/29
10.0.0.24/29
[octopus:~]%
[octopus:~]% aggregate <input-file >output-file
aggregate: maximum prefix length permitted will be 32
[octopus:~]% cat output-file
10.0.0.16/28
192.168.0.0/29
[octopus:~]%
It's quite bad at dealing with really long lists, but it's ok for
small applications. There's a manual page, and options, and stuff. You
can make it show its working, if you're worried about whether it is
sane.
[octopus:~]% aggregate -v <input-file
aggregate: maximum prefix length permitted will be 32
[ 0] + 10.0.0.16/28
[ 0] + 192.168.0.0/29
[ 1] - 192.168.0.0/30
[ 2] - 192.168.0.4/30
[octopus:~]%
I forget exactly what the numbers in the brackets mean, but from
memory 0 means it's a generated prefix and anything else refers to a
line number in the input stream. No doubt the source would provide
illumination.
I don't remember why I thought it was a good idea to spit out the
"maximum prefix length" warning to stderr every time.
Joe
More information about the NANOG
mailing list