I've often had to convert IP range with netmask to a CIDR notation. Below is a quick perl script to help with the conversion:
#!/usr/bin/perl -w
# range2cidr.pl
use Net::CIDR;
use Net::CIDR ':all';
if (@ARGV == 0) {
die "Usage Example: $0 192.168.0.0-192.168.255.255 \n";
}
print join("\n", Net::CIDR::range2cidr("$A RGV[0]")) . "\n";
- sandip's blog
- Login or register to post comments
Comments
You made my day :) This is exactly what I need: a perl script to use within Webmin.
Thanks!
thanks man ! this was very useful !!