• Calculates the optimal prefix length for subdividing a CIDR block to accommodate a given number of subnets.

    Parameters

    • cidr: string

      The CIDR block to subdivide

    • count: number

      The number of subnets needed

    Returns number

    The optimal new prefix length

    Throws

    If the CIDR is invalid or can't accommodate the requested number