Search Domain (DHCP Option 119) not working

Is there anything wrong with this? This is set, but the search domain does not seem to be added through DHCP on iOS.

/ip dhcp-server option add name=domain-search-list code=119 value="0x0c'soonoononono'0x02'co'0x02'uk'"

soonoononono.co.uk

The first part of the domain is obviously mangled, but it has 12 characters.

This is also set:

/ip dhcp-server network add address=192.168.88.0/24 comment=defconf dhcp-option=domain-search-option dns-server=192.168.88.2 domain=soonoononono.co.uk gateway=192.168.88.1 netmask=24

Two points:

  • there is no “end of list” - 0x00 as the last byte of the “list”; I’m not sure whether end of string works the same when the payload is being parsed
  • Mikrotik follows the RFC and only sends options which the client is asking for. So as you say that it does not work with iOS in particular, enable DHCP logging in Mikrotik (/system logging add topics=dhcp) and check that the client sends 119 in the list of requested options

Is this a typo.:
dhcp-option=domain-search-option
when you earlier had:
name=domain-search-list

As sindy pointed out, you’re missing the null termination.
And probably the mistake pointed out by sid5632.
Adding this in /ip dhcp-server option:

add code=119 name=option1 value="0x0c'soonoononono'0x02'co'0x02'uk'0x00"

Which translates in:

/ip dhcp-server option> print
 # NAME          CODE          VALUE                                                           RAW-VALUE                                                     
[..]
 2 option1        119         0x0c'soonoononono'0x02'co'0x02'uk'0x00         0c736f6f6e6f6f6e6f6e6f6e6f02636f02756b00

And selecting that option1 in my networks dhcp settings results in this:

dhcp,debug,packet     Domain-Search = 0C-73-6F-6F-6E-6F-6F-6E-6F-6E-6F-6E-6F-02-63-6F-02-75-6B-00

And I think it works since this can be seen in a Windows 10 clients registry:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{...}]
[...]
"DhcpDomainSearchList"="soonoononono.co.uk"

Thanks everyone. I have fixed that typo, added the null byte and see it now being sent successfully to Windows, but it still does not seem to be working with iOS 14 (actually iPadOS).

I can see in the router log that it is being requested and being sent to the iPad along with the other network information through DHCP. and as it is working on Windows, this is probably some issue to do with iOS/iPadOS.

This feature may have been broken on iOS since v4.3!

https://community.spiceworks.com/topic/135347-iphone-and-ipad-not-recognizing-dns-server-names