Merit Network
Can't find what you're looking for? Search the Mail Archives.
  About Merit   Services   Network   Resources & Support   Network Research   News   Events   Home

Discussion Communities: Merit Network Email List Archives

North American Network Operators Group

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical

Re: subnet aggregation script

  • From: Jeff Walter
  • Date: Mon Sep 21 19:43:07 2009

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.

Here is a Perl script to do just that. My normal one reads from STDIN.


#!/usr/bin/perl

use Net::CIDR::Lite;

my $cidr = Net::CIDR::Lite->new ();

foreach (@ARGV) {
	if (/^[0-9a-f\.:]+(\/\d+)?$/) {
       	        $cidr->add_any ($_);
        }
}

print (join ("\n", $cidr->list ()));





Discussion Communities


About Merit | Services | Network | Resources & Support | Network Research
News | Events | Contact | Site Map | Merit Network Home


Merit Network, Inc.