Hello,

I am using the following in dhcpd.conf to get the logging for Option 82
information -
if exists agent.circuit-id
         {
         log (error,concat("Lease for ",binary-to-ascii (10, 8, ".",
         leased-address)," is connected to ", option agent.circuit-id));
         }

dhcpd[140526]: Lease for 192.168.10.149 is connected to 0LAB-SWITCH_1-2@1
/8/7
dhcpd[140526]: DHCPREQUEST for 192.168.10.149 from XX:XX:XX:c3:b2:10 via
192.168.10.254
dhcpd[140526]: DHCPACK on 192.168.10.149 to XX:XX:XX:c3:b2:10 via
192.168.10.254

I am just using that to only help determine where requests and DHCP
Activity is coming from.

I have tried in Kea 3.0.3 to setup Forensics Logging hook with the
following config -

"library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_legal_log.so",
           "parameters": {
               "base-name": "kea-legal",
               "path": "/var/log/kea",
               //"pattern": "%d{YYYY-MM-DD HH:MM:SS} Lease for %o is
connected to devie %h via {relay-info}\n"
               "request-parser-format": "ifelse(pkt4.msgtype == 4 or
pkt4.msgtype == 7, 'Address: ' + ifelse(option[50].exists,
addrtotext(option[50].hex), addrtotext(pkt4.ciaddr)) + ' has been released
from a device with hardware address: hwtype=' +
substring(hexstring(pkt4.htype, ''), 7, 1) + ' ' + hexstring(pkt4.mac, ':')
+ ifelse(option[61].exists, ', client-id: ' + hexstring(option[61].hex,
':'), '') + ifelse(pkt4.giaddr == 0.0.0.0, '', ' connected via relay at
address: ' + addrtotext(pkt4.giaddr) + ifelse(option[82].option[1].exists,
', circuit-id: ' + hexstring(option[82].option[1].hex, ':'), '') +
ifelse(option[82].option[2].exists, ', remote-id: ' +
hexstring(option[82].option[2].hex, ':'), '') +
ifelse(option[82].option[6].exists, ', subscriber-id: ' +
hexstring(option[82].option[6].hex, ':'), '')), '')"
            }


Then I get the following output in the log file -

2026-11-17 20:37:39 UTC Address: 192.168.254.1 has been assigned for 0 hrs
10 mins 0 secs to a device with hardware address: hwtype=1 XX:XX:XX:ee:55:a0

I know the "request-parser-format" is incorrect.  Below is from a pcap -

21:30:11.658539 IP (tos 0x0, ttl 59, id 11228, offset 0, flags [DF], proto
UDP (17), length 576)
    192.168.254.1.68 > 192.168.124.8.67: [udp sum ok] BOOTP/DHCP, Request
from XX:XX:XX:ee:55:a0, length 548, xid 0x2880d539, Flags [none] (0x0000)
          Client-IP 192.168.254.1
          Client-Ethernet-Address XX:XX:XX:ee:55:a0
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            Hostname (12), length 23: "XXX6E1A22000705_111-t1"
            DHCP-Message (53), length 1: Request
            Parameter-Request (55), length 6:
              Subnet-Mask (1), Default-Gateway (3), Domain-Name-Server (6),
Domain-Name (15)
              BR (28), Vendor-Option (43)
            MSZ (57), length 2: 576
            Vendor-Class (60), length 6: "111-t1"
            Unknown (225), length 1: 52
            Unknown (226), length 1: 111
            Unknown (227), length 1: 56
            Agent-Information (82), length 30:
              Circuit-ID SubOption 1, length 28: 0LAB-SWITCH_1-1@1/1/1
            END (255), length 0
            PAD (0), length 0, occurs 218


21:30:11.665381 IP (tos 0x10, ttl 128, id 0, offset 0, flags [DF], proto
UDP (17), length 387)
    192.168.124.8.67 > 192.168.254.1.68: [udp sum ok] BOOTP/DHCP, Reply,
length 359, xid 0x2880d539, Flags [none] (0x0000)
          Client-IP 192.168.254.1
          Your-IP 192.168.254.1
          Client-Ethernet-Address XX:XX:XX:ee:55:a0
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message (53), length 1: ACK
            Subnet-Mask (1), length 4: 255.255.255.0
            Default-Gateway (3), length 4: 192.168.254.254
            Domain-Name-Server (6), length 8: 8.8.8.8,1.1.1.1
            Hostname (12), length 22: "XXX6E1A22000705_111-t1"
            Domain-Name (15), length 23: "justwork.com"
            Lease-Time (51), length 4: 600
            Server-ID (54), length 4: 192.168.124.8
            Agent-Information (82), length 30:
              Circuit-ID SubOption 1, length 28: 0LAB-SWITCH_1-1@1/1/1
            END (255), length 0

How can I get Kea to output the router/device that the DHCP Activity is
coming from just I have it configured in ISC DHCP?

Thank you for your time!
JTISC
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
[email protected]

Reply via email to