[Kea-users] help with Pg hosts entry
Matt Zagrabelny
mzagrabe at d.umn.edu
Wed Oct 4 21:17:52 UTC 2023
Replying to myself...
On Wed, Sep 27, 2023 at 12:20 PM Matt Zagrabelny <mzagrabe at d.umn.edu> wrote:
> Greetings Kea Users,
>
> I am attempting to get Pg based storage working for my first Kea
> installation.
>
> I'm using kea-dhcp4-server 2.2.1-1
>
> I do have leases in the DB:
>
> z@[local]:kea=# select * from lease4;
> ═[ RECORD 1 ]══╤═════════════════════════════════════════
> address │ 178782308
> hwaddr │ \x9cebe803e3b9
> client_id │ \x019cebe803e3b9
> valid_lifetime │ 3600
> expire │ 2023-09-27 12:45:32-05
> subnet_id │ 1
> fqdn_fwd │ f
> fqdn_rev │ f
> hostname │ ziti
> state │ 0
> user_context │
>
> and I've added a host entry:
>
> INSERT INTO hosts (
> dhcp_identifier,
> dhcp_identifier_type,
> ipv4_address
> )
> VALUES (
> '\x9cebe803e3b9',
> 0,
> 178782258
> );
>
> which yields:
>
> z@[local]:kea=# select * from hosts;
> ═[ RECORD 1 ]═════════╤═══════════════
> host_id │ 3
> dhcp_identifier │ \x9cebe803e3b9
> dhcp_identifier_type │ 0
> dhcp4_subnet_id │ ¤
> dhcp6_subnet_id │ ¤
> ipv4_address │ 178782258
> hostname │ ¤
> dhcp4_client_classes │ ¤
> dhcp6_client_classes │ ¤
> dhcp4_next_server │ ¤
> dhcp4_server_hostname │ ¤
> dhcp4_boot_file_name │ ¤
> user_context │ ¤
> auth_key │ ¤
>
> and my kea config looks like:
>
> $ cat /etc/kea/kea-dhcp4.conf
> "Dhcp4": {
> "interfaces-config": {
> "interfaces": [ "eno1" ]
> },
>
> "control-socket": {
> "socket-type": "unix",
> "socket-name": "/run/kea/kea4-ctrl-socket"
> },
>
> "lease-database": {
> "type": "postgresql",
> "name": "kea",
> "user": "kea",
> "password": "REDACTED",
> "host": "localhost",
> "port": 5432
> },
>
> "hosts-database": {
> "type": "postgresql",
> "name": "kea",
> "user": "kea",
> "password": "REDACTED",
> "host": "localhost",
> "port": 5432
> },
>
> [...]
>
> "subnet4": [
> {
> "subnet": "10.168.0.0/24",
>
> "pools": [ { "pool": "10.168.0.100 - 10.168.0.200" } ],
> }
> ],
> [...]
>
I've added an "id" to the subnet declaration:
"id": 1000,
and updated the entry in the hosts table:
z@[local]:kea=# select * from hosts;
═[ RECORD 1 ]═════════╤═══════════════
host_id │ 3
dhcp_identifier │ \x9cebe803e3b9
dhcp_identifier_type │ 0
dhcp4_subnet_id │ 1000
dhcp6_subnet_id │ ¤
ipv4_address │ 178782258
hostname │ ¤
dhcp4_client_classes │ ¤
dhcp6_client_classes │ ¤
dhcp4_next_server │ ¤
dhcp4_server_hostname │ ¤
dhcp4_boot_file_name │ ¤
user_context │ ¤
auth_key │ ¤
and now I get the address that I'm expecting:
Oct 04 16:13:42 zed kea-dhcp4[5212]: INFO DHCP4_LEASE_ALLOC [hwtype=1
9c:eb:e8:03:e3:b9], cid=[01:9c:eb:e8:03:e3:b9], tid=0x5c6246b4: lease
10.168.0.50 has been allocated for 3600 seconds
I'm still having issues getting the subnet moved from the config file to
the database, but I've asked about that in a separate email to kea-users
(and kea-devel).
Thanks for any help!
-m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20231004/3f15e9cd/attachment.htm>
More information about the Kea-users
mailing list