Fix duplicate ip allocation

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