Thanks Darren for this suggestion:

Hi Jesper,

This is solved in 2.6.1 with "stash-agent-option": true See here:
https://kea.readthedocs.io/en/kea-2.6.1/arm/dhcp4-srv.html#stash-agent-options
for further information.

Thank you,
Darren Ankney


I tried implementing this, but it does not solve my issue. I really can’t tell 
what is causing this to fail, maybe I have just stared at it for too long.

Here is a debug entry from today:


2024-11-03 13:31:25.925 DEBUG [kea-dhcp4.packets/33386.131900472637888] 
DHCP4_BUFFER_RECEIVED received buffer from 100.70.229.212:68 to 
188.228.0.122:67 over interface ens35
2024-11-03 13:31:25.925 DEBUG [kea-dhcp4.options/33386.131900414887616] 
DHCP4_BUFFER_UNPACK parsing buffer received from 100.70.229.212 to 
188.228.0.122 over interface ens35
2024-11-03 13:31:25.925 INFO  [kea-dhcp4.dhcp4/33386.131900414887616] 
DHCP4_QUERY_LABEL received query: [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474
2024-11-03 13:31:25.925 DEBUG [kea-dhcp4.dhcpsrv/33386.131900414887616] 
DHCPSRV_PGSQL_GET_ADDR4 obtaining IPv4 lease for address 100.70.229.212
2024-11-03 13:31:25.926 DEBUG [kea-dhcp4.eval/33386.131900414887616] 
EVAL_DEBUG_OPTION [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: Pushing 
option 82 with value 'false'
2024-11-03 13:31:25.926 DEBUG [kea-dhcp4.dhcpsrv/33386.131900414887616] 
EVAL_RESULT [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: Expression 
Option82Subscribers evaluated to false
2024-11-03 13:31:25.926 INFO  [kea-dhcp4.packets/33386.131900414887616] 
DHCP4_PACKET_RECEIVED [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: DHCPREQUEST 
(type 3) received from 100.70.229.212 to 188.228.0.122 on interface ens35
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.packets/33386.131900414887616] 
DHCP4_QUERY_DATA [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474, packet 
details: local_address=188.228.0.122:67, remote_address=100.70.229.212:68,
msg_type=DHCPREQUEST (3), trans_id=0x2a910474,
options:
  type=012, len=013: "DocsisGateway" (string)
  type=043, len=009:,
options:
    type=002, len=007: 45:52:4f:55:54:45:52
  type=053, len=001: 3 (uint8)
  type=055, len=010: 1(uint8) 3(uint8) 6(uint8) 7(uint8) 15(uint8) 42(uint8) 
51(uint8) 54(uint8) 100(uint8) 0(uint8)
  type=060, len=010: "eRouter1.0" (string)
  type=061, len=015: ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_BEGIN begin all callouts for hook pkt4_receive
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.eval/33386.131900414887616] 
EVAL_DEBUG_SUB_OPTION_NO_OPTION [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: Requested 
option 82 sub-option 2, but the parent option is not present, pushing result 0x
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.flex-id-hooks/33386.131900414887616] 
FLEX_ID_EXPRESSION_EVALUATED Expression evaluated for packet to "" (size: 0)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUT_CALLED hooks library with index 1 has called a callout on hook 
pkt4_receive that has address 0x77f677f6b5f0 (callout duration: 0.080 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUT_CALLED hooks library with index 10 has called a callout on hook 
pkt4_receive that has address 0x77f677fbc620 (callout duration: 0.003 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_COMPLETE completed callouts for hook pkt4_receive (total 
callouts duration: 0.083 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.dhcpsrv/33386.131900414887616] 
DHCPSRV_SUBNET4_SELECT_NO_RAI_OPTIONS No RAI options found to use for subnet 
selection.
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.dhcpsrv/33386.131900414887616] 
DHCPSRV_SUBNET4_SELECT_NO_RELAY_ADDRESS Relay address (giaddr) in client packet 
is empty.
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.dhcpsrv/33386.131900414887616] 
DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_NO_MATCH No subnet matches address: 
100.70.229.212
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.packets/33386.131900414887616] 
DHCP4_SUBNET_SELECTION_FAILED [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: failed to 
select subnet for the client
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.dhcp4/33386.131900414887616] 
DHCP4_CLASS_ASSIGNED [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: client 
packet has been assigned to the following class: UNKNOWN
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.dhcp4/33386.131900414887616] 
DHCP4_CLASSES_ASSIGNED_AFTER_SUBNET_SELECTION [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: client 
packet has been assigned to the following classes: ALL, 
VENDOR_CLASS_eRouter1.0, UNKNOWN
2024-11-03 13:31:25.927 ERROR [kea-dhcp4.bad-packets/33386.131900414887616] 
DHCP4_PACKET_NAK_0001 [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: failed to 
select a subnet for incoming packet, src 100.70.229.212, type DHCPREQUEST
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_BEGIN begin all callouts for hook leases4_committed
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUT_CALLED hooks library with index 10 has called a callout on hook 
leases4_committed that has address 0x77f677fbcb70 (callout duration: 0.013 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_COMPLETE completed callouts for hook leases4_committed (total 
callouts duration: 0.013 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_BEGIN begin all callouts for hook pkt4_send
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUT_CALLED hooks library with index 1 has called a callout on hook 
pkt4_send that has address 0x77f677f69a90 (callout duration: 0.013 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUT_CALLED hooks library with index 10 has called a callout on hook 
pkt4_send that has address 0x77f677fbdd80 (callout duration: 0.001 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.callouts/33386.131900414887616] 
HOOKS_CALLOUTS_COMPLETE completed callouts for hook pkt4_send (total callouts 
duration: 0.014 ms)
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.options/33386.131900414887616] 
DHCP4_PACKET_PACK [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: preparing 
on-wire format of the packet to be sent
2024-11-03 13:31:25.927 INFO  [kea-dhcp4.packets/33386.131900414887616] 
DHCP4_PACKET_SEND [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: trying to 
send packet DHCPNAK (type 6) from 188.228.0.122:67 to 100.70.229.212:68 on 
interface ens35
2024-11-03 13:31:25.927 DEBUG [kea-dhcp4.packets/33386.131900414887616] 
DHCP4_RESPONSE_DATA [hwtype=1 1c:93:7c:33:ec:08], 
cid=[ff:7c:33:ec:08:00:03:00:01:1c:93:7c:33:ec:08], tid=0x2a910474: responding 
with packet DHCPNAK (type 6), packet details: local_address=188.228.0.122:67, 
remote_address=100.70.229.212:68,
msg_type=DHCPNAK (6), trans_id=0x2a910474

On 2 Nov 2024, at 08.14, Jesper Nørgaard <jes...@trommefisk.dk> wrote:

All,

I am setting up a new KEA DHCP solution for an ISP. When clients are doing a 
DISCOVER they source from the CMTS which acts as a relay. They then get the 
correct IP address. But when the client comes back half time with a unicast, 
the DHCP server does not know in which subnet the client belongs and does a 
NAK, meaning the client looses the IP until the client does a new DISCOVER:

tid=0x322cdf6c: failed to select a subnet for incoming packet, src 
100.71.0.208, type DHCPREQUEST

Shouldn’t the DHCP server be able to match the clients IP with a subnet, 
ignoring the client class?



Config:

{
"Dhcp4": {
   "control-socket": {
       "socket-type": "unix",
       "socket-name": "/tmp/kea4-ctrl-socket"
   },
   "hooks-libraries": [
       {
           "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_id.so",
           "parameters": {
               "identifier-expression": "option[82].option[2].hex",
               "replace-client-id": true
           }
       },
       {
           "library": 
"/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_lease_cmds.so",
      "parameters": {
               "store-extended-info": true
           }
       },
       {
           "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_cb_cmds.so"
       },
{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_host_cmds.so"
},
{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_host_cache.so"
},
{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_pgsql_cb.so"
},
{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_subnet_cmds.so"
},
{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_class_cmds.so"
},
{
           "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_stat_cmds.so"
       },

{
    "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_legal_log.so",
    "parameters": {
                   "path": "/var/log/kea",
                   "base-name": "kea-forensic4",
     "time-unit": "second",
     "count": 3600
           }
}
   ],
   "lease-database": {
       "type": "postgresql",
       "port": 5432,
       "max-reconnect-tries": 3,
       "reconnect-wait-time": 50
   },

   "hosts-database": {
       "type": "postgresql",
       "port": 5432,
       "max-reconnect-tries": 3,
       "reconnect-wait-time": 50
    },

    "config-control": {
       "config-databases": [
       {
           "type": "postgresql",

           "port": 5432
       }
       ],
       "config-fetch-wait-time": 20
   },
   "expired-leases-processing": {
       "reclaim-timer-wait-time": 10,
       "flush-reclaimed-timer-wait-time": 25,
       "hold-reclaimed-time": 3600,
       "max-reclaim-leases": 100,
       "max-reclaim-time": 250,
       "unwarned-reclaim-cycles": 5
   },

   "interfaces-config": {
       "interfaces": ["ens35"],
       "dhcp-socket-type": "udp"
   },

   //"host-reservation-identifiers": ["client-id", "hw-address", "circuit-id", 
"flex-id", "duid"],
   "host-reservation-identifiers": ["flex-id"],
   "match-client-id": true,

   "renew-timer": 900,
   "rebind-timer": 1800,
   "valid-lifetime": 3600,


// Logging configuration starts here. Kea uses different loggers to log various
// activities. For details (e.g. names of loggers), see Chapter 18.
       "loggers": [
           {
               "name": "kea-dhcp4",
               "output_options": [
                   {
                       "output": "/var/log/kea/kea-dhcp4.log"
                   }
               ],
               "severity": "INFO",
               "debuglevel": 99
           },
           {
               "name": "kea-dhcp4.leases",
               "output_options": [
                   {
                       "output": "/var/log/kea/kea-dhcp4-leases.log"
                   }
               ],
               "severity": "INFO",
               "debuglevel": 0
           },
           {
               "name": "kea-dhcp4.alloc-engine",
               "output_options": [
                   {
                       "output": "/var/log/kea/kea-dhcp4-alloc-engine.log"
                   }
               ],
               "severity": "INFO",
               "debuglevel": 99
           },
           {
               "name": "kea-dhcp4.ddns",
               "output_options": [
                   {
                       "output": "/var/log/kea/kea-dhcp4-ddns.log"
                   }
               ],
               "severity": "INFO",
               "debuglevel": 0
           }
       ]
   }

}




"shared-networks":[{
"interface":"ens35",
"name":"CMTS-A",
"option-data":[],
"relay":{"ip-addresses":["100.70.224.1","188.228.85.1"]},
"subnet4":[{"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":1,
"option-data":[{
"always-send":false,
"code":3,"csv-format":true,
"data":"100.70.224.1",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[{
"option-data":[],
"pool":"100.70.224.2-100.70.255.254"}],
"relay":{"ip-addresses":[]},
"reservations":[],
"subnet":"100.70.224.0/19"},
{"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":2,
"option-data":[{
"always-send":false,
"code":3,
"csv-format":true,
"data":"188.228.85.1",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[],
"relay":{
"ip-addresses":[]},
"reservations":[],
"subnet":"188.228.85.0/26"}]},
{"interface":"ens35",
"name":"CMTS-B",
"option-data":[],
"relay":{"ip-addresses":["100.71.0.1","188.228.85.65"]},
"subnet4":[{
"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":3,
"option-data":[{
"always-send":false,
"code":3,
"csv-format":true,
"data":"100.71.0.1",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[{
"option-data":[],
"pool":"100.71.0.2-100.71.31.254"}],
"relay":{
"ip-addresses":[]},
"reservations":[],
"subnet":"100.71.0.0/19"},
{"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":4,
"option-data":[{
"always-send":false,
"code":3,
"csv-format":true,
"data":"188.228.85.65",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[],
"relay":{"ip-addresses":[]},
"reservations":[],
"subnet":"188.228.85.64/26"}]},
{"interface":"ens35",
"name":"CMTS-C",
"option-data":[],
"relay":{
"ip-addresses":["100.71.32.1","188.228.85.129"]},
"subnet4":[{
"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":5,"option-data":[{
"always-send":false,
"code":3,
"csv-format":true,
"data":"100.71.32.1",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[{
"option-data":[],
"pool":"100.71.32.2-100.71.63.254"}],
"relay":{
"ip-addresses":[]},
"reservations":[],
"subnet":"100.71.32.0/19"},
{"4o6-interface":"",
"4o6-interface-id":"",
"4o6-subnet":"",
"client-class":"Option82Subscribers",
"id":6,
"option-data":[{
"always-send":false,
"code":3,
"csv-format":true,
"data":"188.228.85.129",
"name":"routers",
"never-send":false,
"space":"dhcp4"}],
"pools":[],
"relay":{
"ip-addresses":[]},
"reservations":[],
"subnet":"188.228.85.128/26"}]}],
"stash-agent-options":false,
"statistic-default-sample-age":0,
"statistic-default-sample-count":20,
"store-extended-info":false,
"subnet4":[],
"t1-percent":0.5,
"t2-percent":0.875,
"valid-lifetime":3600},

"daemonId":3,
"daemonName":"dhcp4",
"editable":true,
"options":{
"options":[{"code":6,
"fields":[{
"fieldType":"ipv4-address",
"values":["81.167.36.5"]},
{"fieldType":"ipv4-address",
"values":["81.167.36.12"]}],
"options":null,
"universe":4},
{"code":15,
"fields":[{
"fieldType":"string",
"values":[""]}],
"options":null,
"universe":4}],


————————————————
Jesper Nørgaard



-- 
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.

Kea-users mailing list
Kea-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to