LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Calculating an IP range (https://www.linuxquestions.org/questions/linux-networking-3/calculating-an-ip-range-4175514965/)

battles 08-15-2014 08:35 AM

Calculating an IP range
 
Can someone tell me how to calculate an IP range. I may not be using the correct terminology, but what I mean is how to calculate something like 221.208.0.0 - 221.212.255.255 to 221.208.0.0/13.

Thanks.

szboardstretcher 08-15-2014 09:46 AM

Something like this?

http://ip2cidr.com/

battles 08-15-2014 10:12 AM

Thanks, but I actually need to know how to programmatically do the conversion.

szboardstretcher 08-15-2014 10:37 AM

If you want to figure it out on paper,. here are a few methods to do so:

http://www.dslreports.com/faq/cisco/...ing_techniques

Once you understand what they are and how to implement them, it shouldn't be too difficult to make your own calculator.

battles 08-15-2014 10:43 AM

Thanks, that is what I need. I am a programmer and need to incorporate this kind of routine in a script.

////// 08-20-2014 08:45 AM

http://search.cpan.org/~mrsam/Net-CIDR-0.11/CIDR.pm

heres perl solution.

battles 08-20-2014 08:50 AM

That is nice, exactly what I needed. I'll have to see how to set perl up, but that shouldn't be too much of a problem.
Thanks.


All times are GMT -5. The time now is 05:53 AM.