[Kea-users] How to insert properly hosts in Kea PostgreSQL database?
Stéphane Klein
contact at stephane-klein.info
Tue Feb 27 15:29:37 UTC 2018
2018-02-27 16:15 GMT+01:00 Tomek Mrugalski <tomasz at isc.org>:
> On 02/27/18 15:38, Stéphane Klein wrote:
> > Do you have example how to insert properly my host in Kea PostgreSQL
> > database?
> Have you read this http://kea.isc.org/wiki/HostReservationsHowTo?
>
>
Thanks
I have written:
DELETE FROM hosts;
INSERT INTO hosts (
dhcp_identifier,
dhcp_identifier_type,
dhcp4_subnet_id,
ipv4_address,
hostname,
dhcp4_next_server,
dhcp4_server_hostname,
dhcp4_boot_file_name
)
VALUES (
DECODE(REPLACE('08-00-27-8e-15-8a', '-', ''), 'hex'),
(SELECT type FROM host_identifier_type WHERE name='hw-address'),
1,
(SELECT ('192.168.0.11'::inet - '0.0.0.0'::inet)),
'blank_machine',
(SELECT ('192.168.0.254'::inet - '0.0.0.0'::inet)),
'blank_machine',
'pxelinux.0'
);
INSERT INTO hosts (
dhcp_identifier,
dhcp_identifier_type,
dhcp4_subnet_id,
ipv4_address,
hostname,
dhcp4_next_server,
dhcp4_server_hostname,
dhcp4_boot_file_name
)
VALUES (
DECODE(REPLACE('08-00-27-8e-15-8b', '-', ''), 'hex'),
(SELECT type FROM host_identifier_type WHERE name='hw-address'),
1,
(SELECT ('192.168.0.12'::inet - '0.0.0.0'::inet)),
'test-dhcp-server',
(SELECT ('192.168.0.254'::inet - '0.0.0.0'::inet)),
'test-dhcp-server',
'pxelinux.0'
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20180227/040091ea/attachment.htm>
More information about the Kea-users
mailing list