[Kea-users] isc_kea: Reuse same IP for a host

Mayank Tiwari mike.tiwari at gmail.com
Tue Jun 2 16:13:49 UTC 2020


Hi,

  It may not be possible to use ::2 as both SOLICIT came at around
same time. In first attempt it allocated ::3.  In the second attempt after
reboot there was release of ::3. So how can I force it to reuse ::3 instead
of looking for new IP ::4 or ::5. kea code has following logic to reuse
expire lease:

} else {

    // If the lease is expired, we may likely reuse it, but...
    if (lease->expired()) {

        ConstHostPtr host;
        if (hr_mode != Network::HR_DISABLED) {
            host = HostMgr::instance().get6(subnet->getID(), hint);
        }

        // Let's check if there is a reservation for this address.
        if (!host) {

            // Copy an existing, expired lease so as it can be returned
            // to the caller.
            Lease6Ptr old_lease(new Lease6(*lease));
            ctx.currentIA().old_leases_.push_back(old_lease);

            /// We found a lease and it is expired, so we can reuse it
            lease = reuseExpiredLease(lease, ctx, pool->getLength(),
                                      callout_status);

            /// @todo: We support only one lease per ia for now
            leases.push_back(lease);
            return (leases);

        } else {
            LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE,
                      ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED)
                .arg(ctx.query_->getLabel())
                .arg(hint.toText());
        }
    }
}



 Not sure why this logic is not getting triggered.

Thanks,
Mayank

On Tue, Jun 2, 2020 at 11:39 AM Mayank Tiwari <mike.tiwari at gmail.com> wrote:

> Hi,
>
>   We have requirement to use same IPv6 for the host after the reboot of
> the host. What we have observed is that every SOLICIT message results in
> allocation of new IP to the host.
>
> First solicit:
> 2020-06-02 14:29:41.499 DEBUG [kea-dhcp6.alloc-engine/1]
> ALLOC_ENGINE_V6_ALLOC_UNRESERVED no static reservations available - trying
> to dynamically allocate leases for client duid=[00:03:00:01:**:45:34],
> tid=0x8be064
>
> Second immediate solicit:
> 2020-06-02 14:29:43.103 DEBUG [kea-dhcp6.alloc-engine/1]
> ALLOC_ENGINE_V6_ALLOC_LEASES_NO_HR no reservations found but leases exist
> for client duid=[00:03:00:01:**:45:34], tid=0xcae8c5
>
>   Both solicit allocate different IP. (First one ::2, Second one ::3)
>
>  Similarly after reboot of host:
>
> First solicit:
> 2020-06-02 14:35:38.020 DEBUG [kea-dhcp6.alloc-engine/1]
> ALLOC_ENGINE_V6_ALLOC_UNRESERVED no static reservations available - trying
> to dynamically allocate leases for client duid=[00:03:00:01:***:45:34],
> tid=0xac71b9
> Second immediate solicit:
> 2020-06-02 14:35:38.023 DEBUG [kea-dhcp6.alloc-engine/1]
> ALLOC_ENGINE_V6_ALLOC_UNRESERVED no static reservations available - trying
> to dynamically allocate leases for client duid=[00:03:00:01:***:45:34],
> tid=0xac71b9
> Both solicit allocates different IP (First one ::4, Second one: ::5)
>
>   How can I override this behaviour in kea so that for the given DUID it
> keeps using same IP address which is allocated for the first time when it
> SOLICITS(::2 in this example).
>
> Thanks,
> Mayank
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20200602/73fb0fe4/attachment.htm>


More information about the Kea-users mailing list