[Kea-users] Vendor Options for Ubiquiti Unifi

Darren Ankney darren.ankney at gmail.com
Tue Feb 13 10:25:40 UTC 2024


Hi Brendan,

Have a look at https://dhcp.isc.org as it is able to convert all of
the ISC DHCP config snip you posted:

{
  # UBNT stuff
  /// This configuration declares some subnets but has no interfaces-config
  /// Reference Kea #245
  "Dhcp4": {
    "option-def": [
      {
        "space": "ubnt",
        "name": "unifi-address",
        "code": 1,
        "type": "ipv4-address"
      }
    ],
    "client-classes": [
      {
        "name": "ubnt",
        /// from: match if (substring(option
dhcp.vendor-class-identifier, 0, 4)) = 'ubnt'
        "test": "substring(option[60].hex,0,4) == 'ubnt'",
        "option-data": [
          {
            "space": "dhcp4",
            "name": "vendor-class-identifier",
            "code": 60,
            "data": "ubnt"
          },
          {
            "name": "vendor-encapsulated-options",
            "code": 43
          }
        ],
        "option-def": [
          {
            "name": "vendor-encapsulated-options",
            "code": 43,
            "type": "empty",
            "encapsulate": "ubnt"
          }
        ]
      }
    ],
    "subnet4": [
      {
        "id": 1,
        "subnet": "192.168.248.0/24",
        "option-data": [
          {
            "space": "ubnt",
            "name": "unifi-address",
            "code": 1,
            "data": "192.168.248.1"
          }
        ]
      }
    ]
  }
}

Thank you,
Darren Ankney

On Mon, Feb 12, 2024 at 4:58 PM brendan kearney <bpk678 at gmail.com> wrote:
>
> List members,
>
> i am migrating to Kea from DHCPd, and have some configs for Unifi
> gear.  as i understand it, these settings make adopting new equipment
> easier, so i am trying to translate from old to new.
>
> in my dhcpd.conf i have the following:
>
> # UBNT stuff
> option space ubnt;
> option ubnt.unifi-address code 1 = ip-address;
>
> class "ubnt" {
>         match if substring (option vendor-class-identifier, 0, 4) = "ubnt";
>         option vendor-class-identifier "ubnt";
>         vendor-option-space ubnt;
> }
>
> subnet 192.168.248.0 netmask 255.255.255.0 {
>   option ubnt.unifi-address 192.168.248.1;
>   ...
> }
>
> in kea, i am not sure how to write code this up.  my best hacks at
> this are not working, and i am hoping someone can help with insight.
> what i have is below, but does not work.  i think there may be a few
> issues, and i have not been able to find good examples to compare
> against.
>
> "option-data": [
>         { "name": "dhcp4.vendor-encapsulated-options", "code": 43,
> "space": "dhcp4", "data": "192.168.248.1" }
>         ],
> ...
> "client-classes": [
>         {"name": "unifi", "test": "option vendor-class-identifier, 0, 4"},
>         ...
> ],
> ...
> "subnet4": [
>         { "id": 248,
>         "subnet": "192.168.248.0/24",
>         "relay": { "ip-addresses": [ "192.168.248.254" ] },
>         "pools": [
>                { "pool": "192.168.248.50 - 192.168.248.74",
> "client-class": "primary-proxied" },
>                 { "pool": "192.168.248.75 - 192.168.248.99",
> "client-class": "secondary-proxied" },
>
>                { "pool": "192.168.248.100 - 192.168.248.124",
> "client-class": "primary-unproxied" },
>                 { "pool": "192.168.248.125 - 192.168.248.149",
> "client-class": "secondary-unproxied" },
>
>                { "pool": "192.168.248.150 - 192.168.248.174",
> "client-class": "primary-unknown" },
>                 { "pool": "192.168.248.175 - 192.168.248.199",
> "client-class": "secondary-unknown" }
>         ],
>         "option-data": [
>                 { "name": "routers", "data": "192.168.248.254" },
>                 { "name": "unifi", "data": "192.168.248.1" }
>         ]
>      },
>      ...
> ]
>
> can any insight be provided?  i would appreciate any input.
>
> thank you,
>
> brendan kearney
> --
> 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 at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users


More information about the Kea-users mailing list