archive.mgm51.com

Sources under BSD licence

Return to Sources under BSD licence home page
Kea scripts

I've started to use the Kea DHCP server on my little home network for IPv4 and IPv6 address delegation. To assist in the operation, I've written two simple scripts to show the leases assigned, one for IPv4 leases and the other for IPv6 leases.

The scripts work only with the memfile lease format.


These scripts can be thought of as a "sketch" that you may want to build upon, or "ideas" that you might want to use in your own scripts. The scripts function on my systems as noted below.

These Kea scripts are released to the Public Domain.

The scripts run under /bin/sh.


Sample output:

% kea-show-leases4.sh 
IPAddr          HWAddr              Lease Start           Renew           Expire          Hostname  State
10.20.2.7       z0:z1:d9:z5:7c:36   14400 20150905T113158 20150905T133158 20150905T153158 host1.    0
10.20.2.6       0z:1z:d9:z5:7c:35   14400 20150905T112931 20150905T132931 20150905T152931 .         0
10.20.2.234     zz:75:0z:1a:a0:98   14400 20150905T112029 20150905T132029 20150905T152029 .         0
172.20.2.222    az:z3:cz:c4:4b:00   14400 20150905T110758 20150905T130758 20150905T150758 .         0

% kea-show-leases6.sh 
IPAddr                              HWAddr              Lease Start           Renew           Expire          Hostname  State   
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T120425 20170821T140425 20170821T160425 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T120425 20170821T140425 20170821T160425 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 0 20170821T100349 20170821T100349 20170821T100349 . 0
fdzz:b7zz:2f4d:1::f004/128 00:zz:d1:zz:47:zz 14400 20170821T120425 20170821T140425 20170821T160425 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T100349 20170821T120349 20170821T140349 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T100349 20170821T120349 20170821T140349 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 0 20170821T080312 20170821T080312 20170821T080312 . 0
fdzz:b7zz:2f4d:1::f004/128 00:zz:d1:zz:47:zz 14400 20170821T100349 20170821T120349 20170821T140349 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T080312 20170821T100312 20170821T120312 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T080312 20170821T100312 20170821T120312 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 0 20170821T060236 20170821T060236 20170821T060236 . 0
fdzz:b7zz:2f4d:1::f004/128 00:zz:d1:zz:47:zz 14400 20170821T080312 20170821T100312 20170821T120312 . 0
2001:db8:6200:4::/62 00:zz:d1:zz:47:zz 14400 20170821T060236 20170821T080236 20170821T100236 . 0

Download Kea show leases scripts 1.3 (1KB)

Tested on:
  • OpenBSD 6.4, Kea 1.4
  • OpenBSD 6.5, Kea 1.5
  • OpenBSD 6.6 and 6.7, Kea 1.6
  • OpenBSD 6.7, Kea 1.7.6
  • OpenBSD 6.8, Kea 1.8.2
  • OpenBSD 6.9, Kea 1.8.2
  • OpenBSD 7.0, Kea 1.8.2
  • OpenBSD 7.1, Kea 2.0.2
  • OpenBSD 7.2, Kea 2.2.0
  • OpenBSD 7.4, Kea 2.4.0
  • OpenBSD 7.5, Kea 2.4.1