>

MikroTik DHCP Option 121 Calculator (Classless Static Routes)

If you want to push routes to your client, the easiest way to do so would be adding a classless static route (DHCP option 121) as defined in RFC 3442. Every router has their way of setting these but usually they have one thing in common – you must do so manually. And yes, if you make a single mistake, your Internet connectivity will be lost.

Issue of easy entry has bothered me for long enough to actually do something about it. Below find classless static route option calculator. Just enter routes you want and you will get their hexadecimal representations.

Network Gateway
Default
DHCP option 121:
Mikrotik code:
/ip dhcp-server option
add code=121 name=classless-static-route-option value=0x00C0A8000118C0A800C0A80001

What DHCP option 121 does

DHCP option 121 (defined in RFC 3442) lets a DHCP server hand out classless static routes to clients along with their IP address. Instead of every device only knowing its default gateway, the client also learns that specific networks, for example a second office subnet or a VPN range, should be reached through a different router. Because the routes arrive with the lease, nothing has to be configured by hand on each laptop or phone.

Why the value has to be calculated

The option value is a compact hex string: for each route, the prefix length, only the significant octets of the destination network, and then the gateway address. Getting one octet wrong silently breaks the route, which is why this calculator builds the string for you and prints the exact /ip dhcp-server option command for RouterOS.

How to apply it in MikroTik RouterOS

  1. Paste the generated command into a terminal (Winbox or SSH) to create the option.
  2. Open IP › DHCP Server › Networks, edit the network your clients use, and add the new option under DHCP Options.
  3. Renew a client's lease and check its routing table: the extra routes should appear next to the default gateway.

Note that Windows, macOS, Linux and Android honour option 121, while some older or embedded clients ignore it, so keep a default gateway in place for those devices.

A free tool by KB Solutions · More free tools: MikroTik Hotspot Users to CSV