Mikrotik Dhcp Domain Search Option

2018/08/02

I recently decided to replace my Netgear Nighthawk R78001 running DD-WRT2, after encountering some stability problems which I wasn’t able to resolve. I decided to move away from normal consumer/enthusiast options and went for a Mikrotik hEX PoE3 paired with a UniFi AP AC LITE4.

RouterOS5 is a very capable commercial grade operating system (OS). Coming from a consumer grade networking device/OS can involve a steep learning curve if you’re not reasonably familiar with networking already. That said, even if you are, there can be some edge cases where the feature or documentation doesn’t behave as expected/described.

My first encounter with this in RouterOS was configuring a DHCP Option to set the Domain Search list6,7,8. Despite what the RouterOS documentation9 says, it turns out that you can’t just use a string value to set this option properly in RouterOS. As noted by pessoft10 and others on the Mikrotik Forums11 this particular DHCP option (there may be others, I am only commenting on this one here), must be correctly formatted according to some rules.

Unlike in the pessoft10 example, I elected not to use compression and simply concatenated the elements with a series of 0x00XX entries finishing with 0x00, as shown below:

/ip dhcp-server option add name=domain-search-list code=119 value="0x0A'engineroom'0x0A'middlearth'0x03'lan'0x0006'bridge'0x0A'middlearth'0x03'lan'0x000A'middlearth'0x03'lan'0x00"

  1. https://www.netgear.com/home/products/networking/wifi-routers/r7800.aspx ↩︎

  2. https://dd-wrt.com/ ↩︎

  3. https://mikrotik.com/product/RB960PGS ↩︎

  4. https://www.ubnt.com/unifi/unifi-ap-ac-lite/ ↩︎

  5. https://mikrotik.com/software ↩︎

  6. https://tools.ietf.org/html/rfc2131 ↩︎

  7. https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml ↩︎

  8. https://tools.ietf.org/html/rfc3397#section-2 ↩︎

  9. https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server#DHCP_Options ↩︎

  10. https://blog.pessoft.com/2016/03/17/domain-search-list-as-dhcp-option-in-mikrotik-routeros/ ↩︎

  11. https://forum.mikrotik.com/viewtopic.php?f=2&t=133801#p658109 ↩︎