5

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?

Greg Bray
  • 5,610
  • 5
  • 36
  • 53

3 Answers3

3

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.

Barre
  • 31
  • 3
  • I googled around a lot and this answer is what finally worked for me. Using USG-3P firmware version 4.4.56 and Unifi controller version 7.0.23. – Moduspwnens Apr 07 '22 at 13:02
2

I'm sure you've figured this out by now, but you can set a "text" type for a custom DHCP option, then just enter a comma separated domain list. Note: it overrides the default provided by the DHCP server, so you need to include that too.

jturle
  • 21
  • 2
  • In UDM (my current Network app version is 7.3.83), the Text option type works for option 119 (hex did not work for me). I simply provided a space-delimited list of domains as the text value, with code 119. I haven't tried commas, but that might work as well. – BHall Jul 10 '23 at 06:12
1

You can now do this in v2.0.9-hotfix.6, but I haven't been able to find the answer anywhere. Here's what worked for me:

configure
set service dhcp-server shared-network-name [your dhcp network name] subnet [your IP subnet] domain-name "subnet1.x.com subnet2.x.com x.com"
commit ; save

You should end up with correctly formatted option domain-name and option domain-search lines in /opt/vyatta/etc/dhcpd.conf.

Karl
  • 11
  • 1