Configure multiple search suffix domains in Unifi Security Gateway (dhcp option 119 domain search)

dhcpubiquitiunifi

I would like to have the DHCP server in my Unifi Security Gatway include multiple domain search entries as part of DHCP option 119 so that I can use shortnames for multiple suffixes like:

  • host -> host.example.com
  • anotherhost -> anotherhost.home.arpa
  • container -> container.somehost.lxd

Currently the Domain Name: example.com entry in the Network settings is used for the option domain-search "example.com" entry in /opt/vyatta/etc/dhcpd.conf, but this field does not allow you to specify multiple entries (probably for good reason).

I attempted to enable a custom DHCP option for Code 119, but this seems to use a raw hex value in the config file like option domain-search 65:78:61:6d:70:6c:65:2e:63:6f:6d:20:68:6f:6d:65:2e:61:72:70:61; for a value of "example.com home.arpa". It also doesn't clear the original entry, which likely causes issues with how the values get encoded on the wire. I tried various values but none seem to show up correctly in /var/lib/dhcp/dhclient.leases

How can I configure multiple search suffixes for my Unifi network?

Best Answer

I know that this is quite old, however using the text type as a custom DHCP option didn't work for me. I needed to add a custom code 119 of type hex array and convert the search list to hex. I wrote a simple python script to convert the domain list and just adding the output from that script worked like a charm for me.