Recently, I needed to push a static route out to all DHCP clients on a network. With my memory full of Cisco ios commands, I figured this would be a piece of cake to implement before going on about my day. Well, come to find, things aren’t as straight forward on a Mikrotik Hex router (which I shouldn’t say was a huge surprise). Options like this are set using the hexadecimal values rather than the dot-decimal octets you’re likely familiar with.

If you want to advertise a static route to your DHCP clients from a DHCP server that you have configured in RouterOS, follow these steps:

  1. Confirm the subnet mask of the network you want to advertise and convert it to hexadecimal.
  2. Confirm the network address of the network you want ot advertise and convert the significant octets into hex.

    • so for a network, you only convert 10.10.10 into hex
    • for a network, you only convert the 10.10 into hex
  3. Confirm the gateway address of the network you want to advertise and convert the entire IP into hex.

  4. Under IP> DHCP Server> Options, add an option with code 121 (signifying a static route) and the data you converted to hex as one long string.

    • so for a network, reachable via you would input 0x180A0A0A0C0C0C96
    • 0x - to signify hex
    • 18 - the hex value for the subnet mask /24
    • 0A0A0A - the hex value for the significant octets of the Network Address, 10.10.10
    • 0C0C0C96 - the hex value of the gateway ip of
      Give your static route a useful name, use 121 to signify a static route to RouterOS, and input your hex value
      RouterOS DHCP Server options setting screen
  5. Under IP> DHCP Server> Networks, choose the network you want to advertise this on, then edit the configuration and select the name of the new option you just defined. Making sure to apply your changes before leaving this config screen.

    Select your newly defined DHCP option for your network and apply the changes
    Apply new options to RouterOS DHCP server to begin advertising

  6. Done, your DHCP server should now be serving the static route you set. Wait for client leases to expire or release and renew on client side. Confirm the new route is present in your DHCP clients routing table before calling it done.

Maybe this is more commonplace than I think, but specifying this information in hexadecimal is not something I was expecting. With a couple minutes and a blank spreadsheet I was able to do the conversion but to make IP to hex conversion easier in the future I am writing a script that will do the work for me. I’ll set it up as a bash script or in python (or both) and will be posting the code to my site when it’s finished. Should be pretty soon.

Hope this was helpful to someone out there! This is all in the documentation from Mikrotik if you look for it but should still be helpful laid out step-by-step.