anyone has netrange -> cidr conversion script to share?
Does anyone here has a script (or perl procedure) for converting range of ips (i.e. 10.0.0.0 - 10.0.2.255) into cidr (i.e. result would be 10.0.0.0/23,10.0.2.0/24 from the example before). If not I'll do it, I'm just hoping somebody is already done something this for another project... Reply off the list. -- William Leibzon Elan Communications Inc. william@elan.net
Net::CIDR - Manipulate IPv4/IPv6 netblocks in CIDR notation use Net::CIDR; use Net::CIDR ':all'; print join("\n", Net::CIDR::range2cidr("192.68.0.0-192.68.255.255", "10.0.0.0-10.3.255.255")) . "\n"; # # Output from above: # # 192.68.0.0/16 # 10.0.0.0/14 ---Mike At 11:12 PM 6/11/2003 -0700, william@elan.net wrote:
Does anyone here has a script (or perl procedure) for converting range of ips (i.e. 10.0.0.0 - 10.0.2.255) into cidr (i.e. result would be 10.0.0.0/23,10.0.2.0/24 from the example before). If not I'll do it, I'm just hoping somebody is already done something this for another project...
Reply off the list.
-- William Leibzon Elan Communications Inc. william@elan.net
-------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet since 1994 www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike
On Wed, Jun 11, 2003 at 11:12:54PM -0700, william@elan.net <william@elan.net> wrote a message of 12 lines which said:
Does anyone here has a script (or perl procedure) for converting range of ips (i.e. 10.0.0.0 - 10.0.2.255) into cidr (i.e. result would be 10.0.0.0/23,10.0.2.0/24 from the example before).
netmask (available as a Debian package or a FreeBSD port) ~ % netmask -c 10.0.0.0:10.0.2.255 10.0.0.0/23 10.0.2.0/24
On Wed, Jun 11, 2003 at 11:12:54PM -0700, william@elan.net said:
Does anyone here has a script (or perl procedure) for converting range of ips (i.e. 10.0.0.0 - 10.0.2.255) into cidr (i.e. result would be 10.0.0.0/23,10.0.2.0/24 from the example before). If not I'll do it, I'm just hoping somebody is already done something this for another project...
excellent Perl script called 'aggis' that used to be available from ftp.merit.edu ... I can't remember where I got it last. Since it's brief, I'm including it here for the sake of the archives. ... (well, I was going to, and saw that it was 557 lines, so I'll just post an url: http://www.darkuncle.net/aggis ) -- Scott Francis || darkuncle (at) darkuncle (dot) net illum oportet crescere me autem minui
participants (4)
-
Mike Tancsa
-
Scott Francis
-
Stephane Bortzmeyer
-
william@elan.net