set_route_distance
Adjust an existing MikroTik route's failover priority by setting its distance, matched by destination address and gateway, with a preview before applying changes.
Instructions
Adjust an existing route's distance (failover priority - lower
distance wins) via /ip/route set distance=<distance>.
Resolved by the STABLE (dst_address, gateway) pair - never a
dynamic .id/list index, which can silently shift as routes are
added/removed elsewhere on the device between a preview and the
confirmed apply. Errors clearly (without changing anything) if no
route matches that pair, or if more than one still does
(AmbiguousResourceError) - this never guesses which route to
touch.
WRITE tool, guarded: blocked entirely unless the server is running with MIKROTIK_ALLOW_WRITE=true. Call with confirm=False (the default) to get a before/after preview without changing anything; call again with confirm=True to actually apply it. See README's "Failover control" section for the recommended step-by-step flow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | ||
| gateway | Yes | ||
| distance | Yes | ||
| device_name | Yes | ||
| dst_address | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||