[Kea-users] Hosts table

Tomek Mrugalski tomasz at isc.org
Tue May 31 17:43:10 UTC 2016


On 31.05.2016 15:14, Thomas Andersen wrote:
>
> Hi,
>
>  
>
> Currently the hosts table is like this:
>
> +----------------------+------------------+------+-----+---------+----------------+
>
> | Field                | Type             | Null | Key | Default |
> Extra          |
>
> +----------------------+------------------+------+-----+---------+----------------+
>
> | host_id              | int(10) unsigned | NO   | PRI | NULL    |
> auto_increment |
>
> | dhcp_identifier      | varbinary(128)   | NO   | MUL | NULL   
> |                |
>
> | dhcp_identifier_type | tinyint(4)       | NO   |     | NULL   
> |                |
>
> | dhcp4_subnet_id      | int(10) unsigned | YES  |     | NULL   
> |                |
>
> | dhcp6_subnet_id      | int(10) unsigned | YES  |     | NULL   
> |                |
>
> | ipv4_address         | int(10) unsigned | YES  |     | NULL   
> |                |
>
> | hostname             | varchar(255)     | YES  |     | NULL   
> |                |
>
> | dhcp4_client_classes | varchar(255)     | YES  |     | NULL   
> |                |
>
> | dhcp6_client_classes | varchar(255)     | YES  |     | NULL   
> |                |
>
> +----------------------+------------------+------+-----+---------+----------------+
>
>  
>
>  
>
> This means I can insert two host reservations for the same MAC address
> on the same subnet id (VLAN).
>
Subnet ID is Kea internal concept. That's how we internally reference
and find subnets - by their unique id. It can, but doesn't have to map
to VLAN tags.

> Will there ever be a time where that is needed?
>
Not that I can think of. Kea 1.0 used MAC address to identify hosts in
v4. We're trying to move to a more generic model, where the host is
identified by (identifier-type, identifier, subnet-id). The identifier
may be: hwaddr/MAC, client-id, DUID and possibly remote-id and
circuit-id (I think the last two are not usable yet). There will surely
be more identifiers in the future added. So if you ask whether
(identifier, subnet-id) could possibly be duplicate? Yes, because in
some deployments remote-id may be equal to the MAC address and user may
put two reservations, one based on MAC and one on remote-id. It doesn't
make much sense operationally in my opinion, but maybe there are some
corner cases when this would be a reasonable thing to do (as a migration
path, perhaps). So the (identifier, subnet) may be duplicate sometimes.
(identifier-type, identifier, subnet) will not.
>
>  
>
> Could it be useful to make a primary key consisting of
> dhcp_identifier, dhcp4_subnet_id and dhcp6_subnet_id?
>
Almost. The tuple of (identifier-type, identifier, dhcp4_subnet_id) must
be unique. The same is true for v6. Now that you mentioned it, we should
probably have indexes there.

Actually, having such indexes on host reservations should speed things
up significantly. I know that Marcin is tweaking the MySQL host
reservations code. I'll put an note in ticket #4281.
>
>  
>
> The reason for my question is that the script I currently use, will
> use a ‘REPLACE INTO’.
>
That should work, but I don't know your data flow to be sure. If you
have a separate system that pushes changes to Kea's MySQL DB, that
should be fine. Just make sure you don't lose other client's
information, e.g. changing reserved IPv4 address should not wipe IPv6
reservations for that client.
>
> **NEVER DISCLOSE YOUR PASSWORD OR SHOE SIZE - NOT EVEN TO YOUR DENTIST**
>
Hey, what's wrong with the shoe size?

Tomek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20160531/239c820f/attachment.htm>


More information about the Kea-users mailing list