Fix duplicate ip allocation

Fixes #5729
Here the trick on border - there is non-zero probability to allocate just released ip from range beginning, when allocations overflow.