[Kea-users] Hi, I have this Kea static configuration: ``` { "Dhcp4": { "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "interfaces-config": { "interfaces": [ "enp0s8" ] }, "lease-database": { "type": "memfile", "name": "/var/kea/dhcp4.leases" }, "valid-lifetime": 4000, "subnet4": [ { "subnet": "192.168.0.0/24", "pools": [ { "pool": "192.168.0.10 - 192.168.0.20" } ], "reservations": [ { "hw-address": "08:00:27:8e:15:8a", "ip-address": "192.168.0.11" }, { "hw-address": "08:00:27:8e:15:8b", "ip-address": "192.168.0.12" } ] } ], "next-server": "192.168.0.254", "boot-file-name": "pxelinux.0" }, "Logging": { "loggers": [ { "name": "kea-dhcp4", "output_options": [ { "output": "stdout" } ], "severity": "INFO" } ] } } ``` It works perfectly. I would like to do the same thing with PostgreSQL backend. I have initialized my PostgreSQL database with: [dhcpdb_create.pgsql ](https://github.com/isc-projects/kea/blob/master/src/share/database/scripts/pgsql/dhcpdb_create.pgsql)
Stéphane Klein
contact at stephane-klein.info
Tue Feb 27 14:35:39 UTC 2018
- Previous message (by thread): [Kea-users] Hi, I have this Kea static configuration: ``` { "Dhcp4": { "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "interfaces-config": { "interfaces": [ "enp0s8" ] }, "lease-database": { "type": "memfile", "name": "/var/kea/dhcp4.leases" }, "valid-lifetime": 4000, "subnet4": [ { "subnet": "192.168.0.0/24", "pools": [ { "pool": "192.168.0.10 - 192.168.0.20" } ], "reservations": [ { "hw-address": "08:00:27:8e:15:8a", "ip-address": "192.168.0.11" }, { "hw-address": "08:00:27:8e:15:8b", "ip-address": "192.168.0.12" } ] } ], "next-server": "192.168.0.254", "boot-file-name": "pxelinux.0" }, "Logging": { "loggers": [ { "name": "kea-dhcp4", "output_options": [ { "output": "stdout" } ], "severity": "INFO" } ] } } ``` It works perfectly. I would like to do the same thing with PostgreSQL backend. I have initialized my PostgreSQL database with: [dhcpdb_create.pgsql ](https://github.com/isc-projects/kea/blob/master/src/share/database/scripts/pgsql/dhcpdb_create.pgsql) I have this kea
- Next message (by thread): [Kea-users] How to insert properly hosts in Kea PostgreSQL database?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Sorry for my mistake in subject message.
2018-02-27 15:33 GMT+01:00 Stéphane Klein <contact at stephane-klein.info>:
> Hi,
>
> I have this Kea static configuration:
>
> ```
> {
> "Dhcp4": {
> "valid-lifetime": 4000,
> "renew-timer": 1000,
> "rebind-timer": 2000,
> "interfaces-config": {
> "interfaces": [ "enp0s8" ]
> },
> "lease-database": {
> "type": "memfile",
> "name": "/var/kea/dhcp4.leases"
> },
> "valid-lifetime": 4000,
> "subnet4": [
> {
> "subnet": "192.168.0.0/24",
> "pools": [
> {
> "pool": "192.168.0.10 - 192.168.0.20"
> }
> ],
> "reservations": [
> {
> "hw-address": "08:00:27:8e:15:8a",
> "ip-address": "192.168.0.11"
> },
> {
> "hw-address": "08:00:27:8e:15:8b",
> "ip-address": "192.168.0.12"
> }
> ]
> }
> ],
> "next-server": "192.168.0.254",
> "boot-file-name": "pxelinux.0"
> },
> "Logging": {
> "loggers": [
> {
> "name": "kea-dhcp4",
> "output_options": [
> {
> "output": "stdout"
> }
> ],
> "severity": "INFO"
> }
> ]
> }
> }
> ```
>
> It works perfectly.
>
> I would like to do the same thing with PostgreSQL backend.
>
> I have initialized my PostgreSQL database with: [dhcpdb_create.pgsql
> ](https://github.com/isc-projects/kea/blob/master/src/
> share/database/scripts/pgsql/dhcpdb_create.pgsql)
>
> I have this kea configuration file:
>
> ```
> {
> "Dhcp4": {
> "valid-lifetime": 4000,
> "renew-timer": 1000,
> "rebind-timer": 2000,
> "interfaces-config": {
> "interfaces": [ "enp0s8" ]
> },
> "lease-database": {
> "type": "memfile",
> "name": "/var/kea/dhcp4.leases"
> },
> "valid-lifetime": 4000,
> "hosts-database": {
> "type": "postgresql",
> "name": "kea",
> "user": "kea",
> "password": "password",
> "host": "127.0.0.1"
> },
> "subnet4": [
> {
> "subnet": "192.168.0.0/24",
> "pools": [
> {
> "pool": "192.168.0.10 - 192.168.0.20"
> }
> ]
> }
> ],
> "next-server": "192.168.0.254",
> "boot-file-name": "pxelinux.0"
> },
> "Logging": {
> "loggers": [
> {
> "name": "kea-dhcp4",
> "output_options": [
> {
> "output": "stdout"
> }
> ],
> "severity": "INFO"
> }
> ]
> }
> }
> ```
>
> Next, for now I have inserted this data in database:
>
> ```
> DELETE FROM lease4;
> INSERT INTO lease4 (
> address,
> hwaddr,
> hostname
> ) VALUES(
> '192.168.0.11'::inet - '0.0.0.0'::inet,
> DECODE(REPLACE('08-00-27-8e-15-8a', '-', ''), 'hex'),
> 'blank_machine'
> );
> INSERT INTO lease4 (
> address,
> hwaddr,
> hostname
> ) VALUES(
> '192.168.0.12'::inet - '0.0.0.0'::inet,
> DECODE(REPLACE('08-00-27-8e-15-8b', '-', ''), 'hex'),
> 'test-dhcp-server'
> );
> ```
>
> but this insert are incomplete.
>
> Do you have example how to insert properly my host in Kea PostgreSQL
> database?
>
> Best regards,
> Stéphane
>
> --
> Stéphane Klein <contact at stephane-klein.info>
> blog: http://stephane-klein.info
> cv : http://cv.stephane-klein.info
> Twitter: http://twitter.com/klein_stephane
>
> _______________________________________________
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
>
>
--
Stéphane Klein <contact at stephane-klein.info>
blog: http://stephane-klein.info
cv : http://cv.stephane-klein.info
Twitter: http://twitter.com/klein_stephane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20180227/acaf5438/attachment.htm>
- Previous message (by thread): [Kea-users] Hi, I have this Kea static configuration: ``` { "Dhcp4": { "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "interfaces-config": { "interfaces": [ "enp0s8" ] }, "lease-database": { "type": "memfile", "name": "/var/kea/dhcp4.leases" }, "valid-lifetime": 4000, "subnet4": [ { "subnet": "192.168.0.0/24", "pools": [ { "pool": "192.168.0.10 - 192.168.0.20" } ], "reservations": [ { "hw-address": "08:00:27:8e:15:8a", "ip-address": "192.168.0.11" }, { "hw-address": "08:00:27:8e:15:8b", "ip-address": "192.168.0.12" } ] } ], "next-server": "192.168.0.254", "boot-file-name": "pxelinux.0" }, "Logging": { "loggers": [ { "name": "kea-dhcp4", "output_options": [ { "output": "stdout" } ], "severity": "INFO" } ] } } ``` It works perfectly. I would like to do the same thing with PostgreSQL backend. I have initialized my PostgreSQL database with: [dhcpdb_create.pgsql ](https://github.com/isc-projects/kea/blob/master/src/share/database/scripts/pgsql/dhcpdb_create.pgsql) I have this kea
- Next message (by thread): [Kea-users] How to insert properly hosts in Kea PostgreSQL database?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Kea-users
mailing list