<div dir="ltr"><pre>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": "<a href="http://192.168.0.0/24">192.168.0.0/24</a>",
        "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
](
<a href="https://github.com/isc-projects/kea/blob/master/src/share/database/scripts/pgsql/dhcpdb_create.pgsql">https://github.com/isc-projects/kea/blob/master/src/share/database/scripts/pgsql/dhcpdb_create.pgsql</a>
)

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": "<a href="http://192.168.0.0/24">192.168.0.0/24</a>",
        "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<br></pre>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Stéphane Klein <<a href="mailto:contact@stephane-klein.info" target="_blank">contact@stephane-klein.info</a>><br>blog: <a href="http://stephane-klein.info" target="_blank">http://stephane-klein.info</a><br>cv : <a href="http://cv.stephane-klein.info" target="_blank">http://cv.stephane-klein.info</a><br>Twitter: <a href="http://twitter.com/klein_stephane" target="_blank">http://twitter.com/klein_stephane</a></div></div></div>
</div>