[Kea-users] Specifying a netmask different for listening and client assignment

Bruce Momjian bruce at momjian.us
Sat Aug 16 14:00:17 UTC 2025


On Sat, Aug 16, 2025 at 08:03:40AM +0000, Francis Dupont wrote:
> In Kea the subnet-mask (1) option is explicitely NOT in the list of
> standard DHCPv4 options configurable by an administrator so trying to
> set a value in an option-data entry does not work.
> 
> So you have to use the flex option hook library to supersede the option
> value before responses are sent. I am afraid that it is the most common
> usage of this tool but it was reported to do the job by all persons
> who asked this question about how to change the netmask in this list...

Huh, I saw this as my first search hit:

	https://kb.isc.org/docs/altering-the-subnet-mask-option-based-on-giaddr

and thought, that can't be the simplest way to set the client's netmask,
but I now know it is the simplest way, and this works fine:

    // Allow the listening netmask to be different from the client's netmask
    // https://kb.isc.org/docs/altering-the-subnet-mask-option-based-on-giaddr
    "hooks-libraries": [
      {
        "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_flex_option.so",
        "parameters": {
          "options": [
            {
              "name": "subnet-mask",
              "supersede": "255.254.0.0"
            }
          ]
        }
      }
    ],

> PS: there is a KB article about this but if you believe this should be
> added as an example in the ARM open a ticket in Kea gitlab.

In reading the KB article, I assume the hook was only for _computing_
the netmask, not the simplest way for a constant netmask.  I was wrong.

Thanks, everything works now.

-- 
  Bruce Momjian  <bruce at momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.


More information about the Kea-users mailing list