Dear revelers, I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format. Example: 5.28.128.0/18 5.28.128.0/20 5.28.128.0/21 5.28.128.0/22 5.28.132.0/23 5.28.136.0/21 5.28.136.0/22 5.29.64.0/18 5.29.64.0/20 5.29.80.0/24 5.29.96.0/20 would reduce to just 2 lines: 5.28.128.0/18 5.29.64.0/18 In the long distant past, I seem to remember hearing or seeing of such a program. Any pointers would be appreciated. Happy New Year, Hank
At 21:25 31/12/2014 +0200, Hank Nussbacher wrote: Answering my own question - is it this? https://github.com/jathanism/cidrize Are there any websites that allow me to paste prefixes and they run it thru cidrize? Thanks, Hank
Dear revelers,
I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format.
Example:
5.28.128.0/18 5.28.128.0/20 5.28.128.0/21 5.28.128.0/22 5.28.132.0/23 5.28.136.0/21 5.28.136.0/22 5.29.64.0/18 5.29.64.0/20 5.29.80.0/24 5.29.96.0/20 would reduce to just 2 lines: 5.28.128.0/18 5.29.64.0/18
In the long distant past, I seem to remember hearing or seeing of such a program. Any pointers would be appreciated.
Happy New Year, Hank
On Wed, Dec 31, 2014 at 09:25:44PM +0200, Hank Nussbacher wrote:
I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format.
Example:
<snip>
For IPv4 On ubuntu/debian: sudo apt-get install aggregate Just pipe it in on STDIN ( | aggregate -q ) and it will output what you want.
In the long distant past, I seem to remember hearing or seeing of such a program. Any pointers would be appreciated.
For IPv6: sudo pip install aggregate6 (source: https://github.com/job/aggregate6) Kind regards, Job
Hi Hank, The Net::IP perl module is a nice candidate. HNY '15 mh Le 31/12/2014 20:25, Hank Nussbacher a écrit :
Dear revelers,
I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format.
Example:
5.28.128.0/18 5.28.128.0/20 5.28.128.0/21 5.28.128.0/22 5.28.132.0/23 5.28.136.0/21 5.28.136.0/22 5.29.64.0/18 5.29.64.0/20 5.29.80.0/24 5.29.96.0/20 would reduce to just 2 lines: 5.28.128.0/18 5.29.64.0/18
In the long distant past, I seem to remember hearing or seeing of such a program. Any pointers would be appreciated.
Happy New Year, Hank
In message <5.1.1.6.2.20141231211552.053fed38@efes.iucc.ac.il>, Hank Nussbacher <hank@efes.iucc.ac.il> wrote:
I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format.
I rolled my own some time ago. It's appended below. It takes the input cidrs either on the command line or via stdin, one per line (with no fluff). It's quite trivial as you can see, but requires the Net::CIDR::Lite package (which does all of the real work). ======================================================================== #!/usr/bin/perl -w use strict; use Net::CIDR::Lite; my $cidr = Net::CIDR::Lite->new; sub process_arg { my ($arg) = @_; unless ($cidr->add($arg)) { die "Error during add of $arg\n"; } } if (scalar @ARGV) { foreach my $arg (@ARGV) { process_arg ($arg); } } else { while (my $line = <STDIN>) { chop $line; process_arg ($line); } } foreach my $c ($cidr->list) { print "$c\n"; }
Hi! undefine@uml:~$ (
cat <<EOF 5.28.128.0/18 5.28.128.0/20 5.28.128.0/21 5.28.128.0/22 5.28.132.0/23 5.28.136.0/21 5.28.136.0/22 5.29.64.0/18 5.29.64.0/20 5.29.80.0/24 5.29.96.0/20 EOF ) |aggregate aggregate: maximum prefix length permitted will be 32 5.28.128.0/18 5.29.64.0/18 undefine@uml:~$ dpkg -l aggregate Wybór:U=nieznany/I=instalacja/R=usunięcie/P=wyczyszczenie/H=zatrzymanie | Stan:N=brak/I=zainstalowany/C=skonfigurowany/U=rozpakowany/ |/ F=częśc. skonfigurowany/H=częśc. zainstalowany/W=wyzw. czek./T=wyzw. zapl. || Błędy?=(brak)/R-do pon. inst. (duże litery w "Stan" i "Błędy"=problemy) ||/ Nazwa Wersja Architektura Opis +++-=================================-=====================-=====================-======================================================================== ii aggregate 1.6-7 amd64 ipv4 cidr prefix aggregator
:-) And happy new year! Happy new year W dniu 31.12.2014 o 20:25, Hank Nussbacher pisze:
Dear revelers,
I am looking for a program or website that can take a list of sorted, overlapping prefixes and can reduce it to the most CIDRized format.
Example:
5.28.128.0/18 5.28.128.0/20 5.28.128.0/21 5.28.128.0/22 5.28.132.0/23 5.28.136.0/21 5.28.136.0/22 5.29.64.0/18 5.29.64.0/20 5.29.80.0/24 5.29.96.0/20 would reduce to just 2 lines: 5.28.128.0/18 5.29.64.0/18
In the long distant past, I seem to remember hearing or seeing of such a program. Any pointers would be appreciated.
Happy New Year, Hank
-- Regards, Andrzej 'The Undefined' Dopierała http://andrzej.dopierala.name/
participants (5)
-
Andrzej Dopierała
-
Hank Nussbacher
-
Job Snijders
-
Michael Hallgren
-
Ronald F. Guilmette