<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 31.05.2016 15:14, Thomas Andersen
wrote:<br>
</div>
<blockquote cite="mid:F1F8DF71-D720-46FF-9DEB-2591A22CB7B8@itu.dk"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Calibri;
color:windowtext;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:Calibri;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Currently
the hosts table is like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">+----------------------+------------------+------+-----+---------+----------------+<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
Field | Type | Null | Key |
Default | Extra |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">+----------------------+------------------+------+-----+---------+----------------+<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
host_id | int(10) unsigned | NO | PRI |
NULL | auto_increment |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp_identifier | varbinary(128) | NO | MUL |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp_identifier_type | tinyint(4) | NO | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp4_subnet_id | int(10) unsigned | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp6_subnet_id | int(10) unsigned | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
ipv4_address | int(10) unsigned | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
hostname | varchar(255) | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp4_client_classes | varchar(255) | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">|
dhcp6_client_classes | varchar(255) | YES | |
NULL | |<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:Courier">+----------------------+------------------+------+-----+---------+----------------+<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">This means I
can insert two host reservations for the same MAC address on
the same subnet id (VLAN).</span></p>
</div>
</blockquote>
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.<br>
<br>
<blockquote cite="mid:F1F8DF71-D720-46FF-9DEB-2591A22CB7B8@itu.dk"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Will there
ever be a time where that is needed?</span></p>
</div>
</blockquote>
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.<br>
<blockquote cite="mid:F1F8DF71-D720-46FF-9DEB-2591A22CB7B8@itu.dk"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Could it be
useful to make a primary key consisting of dhcp_identifier,
dhcp4_subnet_id and dhcp6_subnet_id?</span></p>
</div>
</blockquote>
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.<br>
<br>
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.<br>
<blockquote cite="mid:F1F8DF71-D720-46FF-9DEB-2591A22CB7B8@itu.dk"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The reason
for my question is that the script I currently use, will use
a ‘REPLACE INTO’.</span></p>
</div>
</blockquote>
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.<br>
<blockquote cite="mid:F1F8DF71-D720-46FF-9DEB-2591A22CB7B8@itu.dk"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p></o:p></span></p>
<span style="font-size:10.5pt;color:black"><o:p> </o:p></span>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">**NEVER
DISCLOSE YOUR PASSWORD OR SHOE SIZE - NOT EVEN TO YOUR
DENTIST**</span><o:p></o:p></p>
</div>
</blockquote>
Hey, what's wrong with the shoe size?<br>
<br>
Tomek<br>
<br>
</body>
</html>