[Kea-users] Leases for known clients only - how ?
Jan Rovner
jan.rovner at diadema.cz
Sun Dec 10 10:47:18 UTC 2023
Hello,
I would like to ask about a pure static KEA DHCP server setup, where:
- only the well-known clients with static reservations for their MACs will get reserved IP addrs (leases)
- unknown clients/devices won't get anything (ideally no reply from DHCP server, or some kind of NAK)
If yes, may I ask for a working demo config file - I mean related declarations of pools and client reservations...
For my purposes, I am running a quite old, but working KEA 1.4 instance and would like to upgrade. To filter unwanted clients with unknown MACs, I had to create my own hook (extension written in .c) to accept the requests from registered clients only. And I would like to eliminate this solution...
Pieces of my hook code:
// std::cout << "pkt4_receive MAC : " << hwaddr->toText() << std::endl;
ConstHostPtr host;
ConstHostCollection reservations = HostMgr::instance().getAll(Host::IDENT_HWADDR, &hwaddr->hwaddr_[0], 6);
host = reservations.empty() ? 0 : reservations.at<http://reservations.at>(0);
...
if (!host) {
LOG_INFO(user_chk_logger, USER_CHK_MAC_INVALID).arg(mac_info_str);
// std::cout << "Host not found, setting status to NEXT_STEP_DROP" << std::endl;
handle.setStatus(CalloutHandle::NEXT_STEP_DROP);
}
else {
LOG_INFO(user_chk_logger, USER_CHK_MAC_VALID).arg(mac_info_str);
// std::cout << "Host OK, accepting packtet" << std::endl;
// std::cout << "Subnet ID is " << host->getIPv4SubnetID() << std::endl;
}
Thank you very much.
Sincerely,
Jan Rovner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20231210/a457b3b2/attachment.htm>
More information about the Kea-users
mailing list