Say I've got a begin ip and an end ip. What would be the easiest way to figure out the largest cidr I could allocate from this range in order to reduce fragmentation?
For example, I have the range 10.10.1.0 - 10.10.2.128.
I request a /25. The easiest algorithm would give me 10.10.1.0/25 and be done with it, but then this fragments the /24 and doesn't allocate the /25 (10.10.2.0/25). What I would like to see is to allocate the 10.10.2.0/25 and leave 10.10.1.0-10.10.1.255 untouched.
Any ideas would be welcome. Been beating my head over this for a bit.