<!doctype html>
<html>
 <head> 
  <meta charset="UTF-8"> 
 </head>
 <body>
  <div style="" class="default-style">
   Hi,
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   I would like to understand why KEA allocates an IP which should not be allocated.
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   I have, on purpose (for testing KEA behaviour), declared the following global host reservation:
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   {
   <br>"boot-file-name": "",
   <br>"client-classes": [ ],
   <br>"hostname": "cs-test-1a",
   <br>"hw-address": "xx:xx:xx:xx:ff:3e",
   <br>"ip-address": "yyy.yyy.yyy.11",
   <br>"next-server": "0.0.0.0",
   <br>"option-data": [ ],
   <br>"server-hostname": "",
   <br>"user-context": {""}
   <br>},
   <br>
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   IP address "yyy.yyy.yyy.11" is part of a subnet which is NOT configured in kea-dhcp4.conf.
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   The client, with mac "xx:xx:xx:xx:ff:3e" , requests an IP from a subnet which is correctly identified by KEA, KEA will first allocate the IP (although it should not because it is not part fo that subnet), and then in a later step, KEA will send a NACK.
  </div>
  <div style="" class="default-style">
   See logs below.
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   My question is: 
  </div>
  <div style="" class="default-style">
   ISC DHCP would not do that. 
  </div>
  <div style="" class="default-style">
   ISC DHCP would allocate an IP from a pool of the selected subnet because the reserved IP does not match.
  </div>
  <div style="" class="default-style">
   Is it expected that KEA does not behave the same way ?
  </div>
  <div style="" class="default-style">
   Is there any tuning that can be used so that KEA behaves the same way as ISC DHCP used to behave ?
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   Thanks,
  </div>
  <div style="" class="default-style">
   Veronique
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   logs:
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   # DISCOVER
  </div>
  <div style="" class="default-style">
   <br>
  </div>
  <div style="" class="default-style">
   <div class="default-style">
    2022-08-30 11:53:03.131 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_RECEIVED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: DHCPDISCOVER (type 1) received from my_router_ip to my_kea_server_ip on interface enp3s0f0
   </div>
   <div class="default-style">
    <br>2022-08-30 11:53:03.132 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_SUBNET_SELECTED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: the subnet with ID 2887444672 was selected for client assignments
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.133 DEBUG [kea-dhcp4.alloc-engine/21553.140195413911744] ALLOC_ENGINE_V4_DISCOVER_HR client [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b sending DHCPDISCOVER has reservation for the address yyy.yyy.yyy.11
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    # OFFER 
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.133 INFO [kea-dhcp4.leases/21553.140195413911744] DHCP4_LEASE_ADVERT [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: lease yyy.yyy.yyy.11 will be advertised
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.133 DEBUG [kea-dhcp4.options/21553.140195413911744] DHCP4_PACKET_PACK [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: preparing on-wire format of the packet to be sent
    <br>2022-08-30 11:53:03.133 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_SEND [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: trying to send packet DHCPOFFER (type 2) from my_kea_server_ip:67 to my_router_ip:67 on interface enp3s0f0
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    # REQUEST 
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.608 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_RECEIVED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: DHCPREQUEST (type 3) received from my_router_ip to my_kea_server_ip on interface enp3s0f0
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.611 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_SUBNET_SELECTED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: the subnet with ID 2887444672 was selected for client assignments
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.612 DEBUG [kea-dhcp4.alloc-engine/21553.140195413911744] ALLOC_ENGINE_V4_REQUEST_ALLOC_REQUESTED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: trying to allocate requested address yyy.yyy.yyy.11
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    # ACK 
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.612 INFO [kea-dhcp4.leases/21553.140195413911744] DHCP4_LEASE_ALLOC [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: lease yyy.yyy.yyy.11 has been allocated for 242 seconds
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:53:03.613 DEBUG [kea-dhcp4.options/21553.140195413911744] DHCP4_PACKET_PACK [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: preparing on-wire format of the packet to be sent
    <br>2022-08-30 11:53:03.613 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_SEND [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: trying to send packet DHCPACK (type 5) from my_kea_server_ip:67 to my_router_ip:67 on interface enp3s0f0
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    # 2nd REQUEST but this time subnet selection fails
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:54:44.178 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_RECEIVED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: DHCPREQUEST (type 3) received from yyy.yyy.yyy.11 to my_kea_server_ip on interface enp3s0f0
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:54:44.180 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_SUBNET_SELECTION_FAILED [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: failed to select subnet for the client
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:54:44.181 ERROR [kea-dhcp4.bad-packets/21553.140195413911744] DHCP4_PACKET_NAK_0001 [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: failed to select a subnet for incoming packet, src yyy.yyy.yyy.11, type DHCPREQUEST
    <br>
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    # NACK
   </div>
   <div class="default-style">
    <br>
   </div>
   <div class="default-style">
    2022-08-30 11:54:44.181 DEBUG [kea-dhcp4.options/21553.140195413911744] DHCP4_PACKET_PACK [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: preparing on-wire format of the packet to be sent
    <br>2022-08-30 11:54:44.181 DEBUG [kea-dhcp4.packets/21553.140195413911744] DHCP4_PACKET_SEND [hwtype=1 xx:xx:xx:xx:ff:3e], cid=[no info], tid=0xa4a8ab1b: trying to send packet DHCPNAK (type 6) from my_kea_server_ip:67 to yyy.yyy.yyy.11:68 on interface enp3s0f0
    <br>
   </div>
  </div>
 </body>
</html>