Adding Domain Search Option to Mikrotik DHCP

I already wrote about using Mikrotik's DNS to resolve a short name lookup in Windows. And there I noted that domain-name DHCP option seemingly has no effect on Linux. Well, let me introduce you to domain search option.

Most of the Linux/Unix based operating systems, whether it is Linux, FreeBSD, or MacOS support arguably a more proper way to define which domain we are referring to when using a single word host name.

To define suffix for domain search, just add option 119:

/ip dhcp-server option
add name="domain-search-option" code=119 value="'example'"

And of course add this option to DHCP network:

/ip dhcp-server network
set 1 dhcp-option=domain-search-option

PS: And no, you cannot use this instead of domain-name. Windows clients only support domain-name while Linux/Mac only supports domain-search option.

2 thoughts to “Adding Domain Search Option to Mikrotik DHCP”

  1. This option is a list (see your RFC3397), so use instead:
    /ip dhcp-server option add name=”domain-search-option” code=119 value=”0x04’home’0x00″

    Another real life example:
    /ip dhcp-server option add name=”domain-search-option” code=119 value=”0x02’ad’0x04’test’0x03’com’0x02’uk’0x00C003″

    this is analog to resolv.conf’s:

    search ad.test.com.uk test.com.uk

  2. This has been driving be crazy ever since I bought a Mikrotik router a few years ago and I couldn’t get my hostnames to resolve in Linux Mint 20. I just now found your post. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *