[Kea-users] Host reservations in DB

Tomek Mrugalski tomasz at isc.org
Fri Dec 18 12:58:08 UTC 2015


On 18.12.2015 07:12, Михаил Ермаков wrote:
> Hi everybody!
> 
> It's not clear for me how Kea stores address reservations of hosts.
> There is something about it in 1.0.0-beta release notes "Leases and
> (DHCPv4)host reservations stored in MySQL or Postgres".
Does it say MySQL or Postgres? Uh oh, in this case it's a mistake.
Storing host reservations is supported in MySQL only.

> Ok. I use 0.9.2. So... I can add record to PostgreSQL with appropriate
> values (address, hwaddr, lifetime...) and my PC will get this address.
Yes. What you can do in 0.9.2 is to add, modify or delete leases.

> There is no lease expiration mechanism in 0.9.2.
There is not. The expired leases can be picked up and reused for other
clients, though.

> My record would be in database forever.
No. It won't be there forever. There are two ways in which this lease
could go away. First, a host that received it may send Release and it
will cause the server to delete the lease. Second, if the lease lifetime
passes without the client renewing it, the lease will become expired. It
will still be in the DB, but the server is allows to reuse it for other
hosts.

> Is it host reservation?
No. Leases represent current state of the address pool: what is leased
to who. You can think about this as a dynamic thing. An address X
currently belongs to client Y, but it may be reassigned to client Z
after client Y releases it or goes away and the lease expires.

Host reservation is something different. It's explained in Kea User's
Guide, section 7.3
(http://git.kea.isc.org/~tester/kea/guide/kea-guide.html#host-reservation-v4).
Host reservation is an instruction to the server that address X is
reserved for client Y and nobody else is allowed to get this address.
The server will not assign it to anyone else, even if the client Y does
not currently use it.

This functionality has been supported for a long time (from 0.9 IIRC).
Host reservations are defined in the configuration file. What was added
in 1.0.0-beta is the ability to store this information in MySQL. See
hosts table.

Once again to clarify, storing host reservations is not supported in
Postgres yet. There's a tentative plan to add it to 1.1.

> What I understand wrong? Why I shouldn't add this records to DB?
I assume that by 'this' you mean records in leases table, right? You can
add, modify or delete them, but you need to understand the lifecycle of
the lease. If you don't know what you are doing, you can hurt yourself
easily.

If you want to do host reservations and keep it in DB, you should use
1.0.0-beta and use MySQL. Make sure you configured hosts-database entry
(see Section 7.2.3:
http://git.kea.isc.org/~tester/kea/guide/kea-guide.html#idp64613328).
Then, put information about your hosts in hosts table. The server will
use it when the client comes and will generates leases based on your
host reservations. Once the client goes away or sends Release, the
leases may disappear. But the host reservation will be there and it will
prevent the server from assigning this address to anyone else.

Hope that helps,
Tomek




More information about the Kea-users mailing list