Domain Search List option in DHCP (code 119), must follow RFC3397 requirements to work. Check out RFC example, which sums it up pretty well. Here is a short list of these requirements:

  • Domain name is split by dots into individual parts
  • Each domain part is prefixed with its length
  • Each domain name is separated by NUL octet
  • Each following domain name must use DNS domain name compression

Here are some examples for implementation in RouterOS:

One domain in search list

Domain used: onlyone.example.net

Command:

/ip dhcp-server option add name=domain-search-list code=119 value="0x07'onlyone'0x07'example'0x03'net'"

Two domains in search list

Domains used: first.example.net, second.example.net

Command:

/ip dhcp-server option add name=domain-search-list code=119 value="0x05'first'0x07'example'0x03'net'0x0006'second'0xc006"

The most tricky part in this example is compression usage for the second domain in the list. It is represented by the last 2 octets (0xc006):

  • Octet c0 represents 2 left-most bits set to 1. It is a flag for compression pointer.
  • Octet 06 represents the pointer itself. It points to the 6th byte of our DHCP option value. This is where length byte of example domain part starts.

Mentioned command adds DHCP option to the list of options for DHCP server. Each option then can be assigned to DHCP network and server will provide it to clients.


4 Comments

John Simpson · July 31, 2016 at 20:13

Thank you for the examples of how to do the DNS encoding. This page saved me at least half an hour of trial-and-error before I would have gone digging through the RFCs. 🙂

Also, I wrote a Perl script which calculates the raw values for you. You and your readers might find it useful.

https://www.jms1.net/code/#dhcp119

    Pessoft · August 11, 2016 at 22:47

    I’m glad, the information is helpful. Also thank you for your script 😉

دامنه · November 1, 2016 at 06:31

many thanks for info

xiaofang · August 12, 2018 at 09:29

I am from china , thanks very much!!

Leave a Reply

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