Documentation / DNS

Static DNS

Keep your static DNS names in one place, for the whole fleet, a site or a single router, and let the manager write them to the routers you switch it on for.

What it does

The DNS page keeps static DNS records in the manager and writes them to the routers you choose, so the same names resolve the same way everywhere. The manager is the source: you add a record once, and every router it applies to gets a copy. Types A, AAAA and CNAME are supported. (v1.106.0+)

Nothing is written to a router until you switch sync on for it. Until then the page is a list of records and the device tab shows what a sync would do.

If you already keep your DNS on one router, you can let the manager copy it from there instead: see Replication from a router. The page has three tabs for this: Records, Replication and History. (v1.107.0+)

Records and where they apply

A record applies to every device, to one site, or to one device. A router gets all three sets: the records for every device, those for its site and its own. When two of them have the same name and type, the narrower one wins on that router, so a site can give a name its own address and one device can differ again.

Each record has a name, a type, a value (an address, or the target name for a CNAME), a TTL, whether it also answers every subdomain, whether it is disabled, and an optional note. The TTL is one hour unless you set it, and takes the forms RouterOS uses, such as 30m, 1h30m or 1d 02:00:00. Names are stored in lower case without a trailing dot, and an IPv6 address in its short form. The note stays in the manager and is not written to the router. One scope cannot hold the same name and type twice.

Filter the page by a site or a device to see exactly what those routers get, records for every device included. A record that a narrower one replaces there is marked overridden. On the Sites page, DNS records in a site's ⋯ menu opens the page filtered to that site.

Deleting a site or a device deletes the DNS records kept for it, and the confirmation says how many there are.

The DNS card on a device

The DNS card on the Routing tab of a device page lists the router's own static entries. It reads them when you open the tab and on Refresh, never in the background. Dynamic entries are hidden behind Show dynamic. If the router cannot be read, the tab says so instead of showing an empty list. SNMP-only devices have no DNS tab.

Under the entries the tab shows what a sync would change on this router: records to add, entries to change, entries the manager would take over, marked entries it would remove, and duplicates it would leave alone. While sync is off for the device this is only a preview.

Sync

Sync is off everywhere until you switch it on, either for a site (on the DNS page filtered to that site) or for one device (Sync settings on its DNS card). A device's own setting beats its site's, so a router can stay out of a site-wide sync or run on its own interval. The interval is 5 to 1440 minutes, 15 by default.

Turning sync on shows what the first pass will change before it runs. For a site that means reading every router that follows the site setting.

The entries the manager writes carry the comment mikr-dns on the router. A pass reads the router, makes the changes and reads it again, and the second read decides the result: OK, Partly applied or Failed. On the router:

  • A record the router lacks is added.
  • A marked entry that differs from its record is set back, including one changed by hand on the router.
  • An unmarked entry with the same name and type as a record is taken over. Its old value and comment go into the history, so it can be put back.
  • A second entry with the same name and type is left alone and reported as a duplicate.
  • A marked entry that no record asks for any more, because the record was deleted or the device left its scope, is removed.
  • Other entries and every dynamic entry are never touched.

Sync now on the device tab runs a pass at once, and Sync all now on the DNS page runs one on every router you can see that has sync on, or only on those of the site in view. A scheduled pass skips a router that was offline at the last poll, and the router is caught up on its first pass after it is back.

The history keeps every pass that changed something or failed, the last 100 per device, with what was added, changed, taken over or removed. A pass that found nothing to do only updates the last-pass line. It is on the History tab, together with the passes of replication rules; the Rule column says which rule ran a pass. (v1.107.0+)

Importing from a router

Import into mikr on a device's DNS card turns entries the router already has into records. It lists the entries the manager can keep (A, AAAA and CNAME entries with a name, not dynamic), each with a tick box, and says how many others were left out. Choose the scope to keep them for: every device, the device's site, or the device alone. An entry already kept for that scope with the same name and type is marked already in mikr and unticked.

The values are read from the router at the moment you import, and the TTL, subdomain setting and disabled state come with them. The entry's comment becomes the record's note. Nothing is written to the router by the import; once sync is on, the next pass takes the entries over and changes only their comment.

Replication from a router

A replication rule copies the static entries of one router, the source, to other routers on a schedule. The source is only ever read. You make the rule on the Replication tab. (v1.107.0+)

  • Targets are routers, sites, or both. A ticked site includes routers added to it later.
  • Filters narrow what is copied: record types, skip disabled entries, only names under a domain, only entries whose comment contains a text.
  • On the targets: Add and update never removes anything. Mirror also removes entries the manager copied earlier that the source no longer has. Entries made by hand on a target stay in both modes. Mirror refuses to run when the filters leave nothing on the source, so an empty read cannot wipe the targets.
  • Run every 5 minutes to 1 day, or Manual only. Sync now runs a rule at once, and Edit sits next to it. Pause or Resume and Delete rule… are in the rule's ⋯ menu.

Every static type RouterOS has is copied: A, AAAA, CNAME, FWD, MX, NS, NXDOMAIN, SRV and TXT, each with its own fields, the TTL, match-subdomain, disabled and address-list. Regexp and dynamic entries are not. Copied entries carry the same mikr-dns comment as synced records, and a target gets the same pass a sync does: read, change, read again, with the result in the history.

A run reads the source once. If the source cannot be read, the run stops before any target is touched. A scheduled run skips a target that was offline at the last poll, and the target catches up on the next run.

Preview on the rule form reads every router and shows what a run would add, change, take over and remove on each target, before you save.

One source per router

  • A router takes its DNS either from records in the manager or from one rule, not both. Switching records sync on for a router takes it out of the rule; the rule then lists it as Uses DNS records from mikr.
  • No chains: a source is never a target, of its own rule or of another.
  • When two rules would cover the same router, the older rule keeps it. Saving refuses a rule that would take a router from another rule, copy to another rule's source, or name a router that cannot follow it.

On a target, the device's DNS card says which rule and source it follows, and its preview is planned from the source. On a source, the card says which rules read it.

Who can do what

Every role can read the records for every device and those for the sites and devices it can see. Operators and administrators add, change, delete and import records and change sync settings inside their own sites. A record for every device lands on every router, so only an account that sees the whole fleet can create or change one. Viewers read. Record changes, imports, sync settings and manual sync runs are recorded in the Activity log.

Replication rules are for operators and administrators, inside their scope: the source and every target site and router have to be ones they can see. Rule changes and runs are recorded in the Activity log too. (v1.107.0+)