add_route
Add a static route on a MikroTik device by specifying destination and gateway, with optional distance and comment; preview changes first, then confirm to apply.
Instructions
Add a static route (/ip/route add): dst_address and
gateway are required, distance (failover priority - lower wins)
and comment are optional. Never refuses a duplicate dst_address
multiple routes sharing one is the normal failover shape.
RISK: adding/overriding the default route (dst_address="0.0.0.0/0"
or "::/0") redirects all outbound traffic through the new
gateway. The returned preview's warning field is non-null
whenever this is the case - always check it before calling again
with confirm=true.
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 (including the warning
field) without changing anything; call again with confirm=True to
actually apply it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment | No | ||
| confirm | No | ||
| gateway | Yes | ||
| distance | No | ||
| device_name | Yes | ||
| dst_address | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||