Daniel Hartmeier wrote:

No, you'll have to break it down into multiple CIDR blocks, in this case

  { 10.0.0.210/31, 10.0.0.212/30, 10.0.0.216/29, 10.0.0.224/29, \
    10.0.0.232/30 }

There probably is some tool that calculates the least number of blocks
that represent an arbitrary range, but I can't remember. Another reader
might :)

I use the Net::CIDR Perl module:

#!/usr/bin/perl
use Net::CIDR;
use Net::CIDR ':all';

print join("\n",
  Net::CIDR::range2cidr("10.0.0.210 - 10.0.0.235",
                        "10.1.2.0   - 10.2.3.128"))
  . "\n";

10.0.0.210/31
10.0.0.212/30
10.0.0.216/29
10.0.0.224/29
10.0.0.232/30
10.1.2.0/23
10.1.4.0/22
10.1.8.0/21
10.1.16.0/20
10.1.32.0/19
10.1.64.0/18
10.1.128.0/17
10.2.3.0/25
10.2.3.128/32
10.2.0.0/23
10.2.2.0/24

--Oliver

Reply via email to