[Kea-users] help with Pg hosts entry

Matt Zagrabelny mzagrabe at d.umn.edu
Wed Sep 27 17:20:36 UTC 2023


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" } ],
        }
    ],
    [...]

However, when my client attempts to get an address, I get:

Sep 27 12:07:59 zed kea-dhcp4[232795]: INFO  DHCP4_INIT_REBOOT [hwtype=1
9c:eb:e8:03:e3:b9],
cid=[ff:d5:ad:cf:0d:00:02:00:00:ab:11:1e:cb:1c:43:6d:72:82:5f],
tid=0xc0909510: client is in INIT-REBOOT state and requests address
10.168.0.103
Sep 27 12:07:59 zed kea-dhcp4[232795]: INFO  DHCP4_LEASE_ALLOC [hwtype=1
9c:eb:e8:03:e3:b9],
cid=[ff:d5:ad:cf:0d:00:02:00:00:ab:11:1e:cb:1c:43:6d:72:82:5f],
tid=0xc0909510: lease 10.168.0.103 has been allocated for 3600 seconds
Sep 27 12:08:02 zed kea-dhcp4[232795]: INFO  DHCP4_LEASE_ADVERT [hwtype=1
9c:eb:e8:03:e3:b9], cid=[01:9c:eb:e8:03:e3:b9], tid=0x40ac136c: lease
10.168.0.100 will be advertised
Sep 27 12:08:02 zed kea-dhcp4[232795]: INFO  DHCP4_LEASE_ALLOC [hwtype=1
9c:eb:e8:03:e3:b9], cid=[01:9c:eb:e8:03:e3:b9], tid=0x40ac136c: lease
10.168.0.100 has been allocated for 3600 seconds

That is, I am expecting Kea to hand out 10.168.0.50, but it is handing out
two addresses from the pool. This might be due to two different DHCP
clients running on the client system (systemd-networkd and perhaps
Network-Manager). I plan to dig into the two lease issue after figuring out
the hosts table issue.

Any ideas on what I'm missing so that kea uses the hosts table for IP
address assignments for given MAC addresses?

Thanks for any help!

-m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20230927/b6f6ea63/attachment-0001.htm>


More information about the Kea-users mailing list