add_static_dns
Create a static DNS entry on a MikroTik device to map a name to an IPv4/IPv6 address or CNAME alias, block domains, or set internal overrides. Requires write access and confirmation.
Instructions
Create a static DNS entry (/ip/dns/static add) resolving name
to address.
record_type is "A" (default) or "CNAME": for "A", address
is a literal IPv4/IPv6 address; for "CNAME", address is itself
another hostname (the alias target), written to RouterOS's cname
field. Useful to block a malicious domain (point it at 0.0.0.0) or
set up an internal DNS override.
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. Errors clearly
(without creating anything) if a row already matches this exact
name+record_type pair - it never creates a duplicate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ttl | No | ||
| name | Yes | ||
| address | Yes | ||
| comment | No | ||
| confirm | No | ||
| device_name | Yes | ||
| record_type | No | A |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||