aknudsen

CIDR to IP range

Discussion created by aknudsen on Oct 28, 2017
Latest reply on Dec 14, 2017 by aknudsen

As I do a lot of work with CIDR blocks and the need to expand them into IP addresses, I've been looking around for a function or plugin to solve the problem. With the exception of the CIDR2IPList_IPV4 function by Maxwell Klein, I've not found any.

 

The problem with this function is that it will return all IP addresses in a block. Though it's technically correct, the .0 and the .255 addresses is the network address and broadcast address and not a usable IP address

 

The second problem is that FM can't do recursive beyond a /19 address space and in my work I deal with a lot of /16 and /18 IP ranges.

 

Since I need usable IP addresses only, I came up with this script leveraging the functions IP2IPLong and IPLong by Dick Impens. When the CIDR notation goes above /24 we also need to drop the last two addresses in the range to get the correct number of usable addresses. What this script does not do, is supernetting a Class C address space.

 

If anyone know of a function/plugin that handles IP and CIDR stuff I would love to know. Feedback is also appreciated if you find this useful.

Attachments

Outcomes