<div dir="ltr"><div dir="ltr"><div dir="ltr">The best link used to be here:<div><a href="https://kea.isc.org/wiki/HostReservationsHowTo">https://kea.isc.org/wiki/HostReservationsHowTo</a><br></div><div>Alas that is not resolving anymore. Here is essentially the SQL command from that link (was when 1.3 was new...but should be basically the same in newer versions). </div><div>I may have added the 'ON DUPLICATE KEY UPDATE' bit, since I use ansible to provision this, but I cannot recall.</div><div><br></div><div><div>START TRANSACTION;</div><div>SET @ipv4_address='10.50.25.254';</div><div>SET @ipv4_reservation=INET_ATON(@ipv4_address);</div><div>SET @ipv6_address_reservation='fc00:10:50:25::254';</div><div>SET @dhcp4_subnet_id=25;</div><div>SET @dhcp6_subnet_id=25;</div><div>SET @hostname = 'utility';</div><div>SET @identifier_type='hw-address';</div><div>SET @identifier_mac='00:05:1b:d0:4f:84';</div><div>SET @identifier_value=UNHEX(REPLACE(@identifier_mac, ':', ''));</div><div><br></div><div>INSERT INTO hosts (dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, dhcp6_subnet_id, ipv4_address, hostname)</div><div>VALUES (</div><div>    @identifier_value,</div><div>    (SELECT type FROM host_identifier_type WHERE name=@identifier_type),</div><div>    @dhcp4_subnet_id, </div><div>    @dhcp6_subnet_id, </div><div>    @ipv4_reservation, </div><div>    @hostname</div><div>)</div><div>ON DUPLICATE KEY UPDATE </div><div>    dhcp_identifier=@identifier_value, </div><div>    dhcp4_subnet_id=@dhcp4_subnet_id, </div><div>    dhcp6_subnet_id=@dhcp6_subnet_id, </div><div>    ipv4_address=@ipv4_reservation, </div><div>    hostname=@hostname</div><div>;</div><div>SET @inserted_host_id = (SELECT host_id FROM hosts WHERE dhcp_identifier=@identifier_value);</div><div>INSERT INTO ipv6_reservations (address, type, host_id)</div><div>VALUES (@ipv6_address_reservation, 0, @inserted_host_id)</div><div>ON DUPLICATE KEY UPDATE </div><div>    address=@ipv6_address_reservation, </div><div>    type=0, </div><div>    host_id=@inserted_host_id</div><div>;</div><div>COMMIT;</div></div><div><br></div><div><br></div><div>Cheers,</div><div>Jason</div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 7, 2019 at 2:05 PM MRob <<a href="mailto:mrobti@insiberia.net">mrobti@insiberia.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, I learned how to insert into mysql host reservations for the <br>
dhcp_identifier column like this:<br>
<br>
INSERT INTO hosts (dhcp_identifier, hostname) VALUES <br>
(UNHEX(REPLACE('AA:BB:11:22:CC:33', ':', '')), 'myhost')<br>
<br>
Can anyone help me understand how to insert IPv4 address into the <br>
"ipv4_address" column, the data type is integer.<br>
<br>
Thank you.<br>
_______________________________________________<br>
Kea-users mailing list<br>
<a href="mailto:Kea-users@lists.isc.org" target="_blank">Kea-users@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/kea-users" rel="noreferrer" target="_blank">https://lists.isc.org/mailman/listinfo/kea-users</a><br>
</blockquote></div>