Skip to content

Routing Identity

The Routing Identity (Router ID) feature in MikroTik RouterOS provides a mechanism to assign a unique identifier to the router for use by routing protocols that require explicit router identification. While many routing protocols can automatically derive their router identifier from available IP addresses, the routing identity configuration allows explicit control over this critical parameter.

Router ID is most prominently used by OSPF (Open Shortest Path First), where each router within an OSPF domain must have a unique router ID to identify itself in LSAs and neighbor relationships. While OSPF can automatically select a router ID from the router’s IP addresses, explicit configuration provides predictability and simplifies network documentation.

The /routing/id menu in RouterOS controls how the system derives dynamic router IDs from available interface addresses. This is useful when you want dynamic selection to be limited to a specific VRF instead of accepting the default selection behavior. The displayed dynamic-id value is auto-assigned by RouterOS and is not a configurable argument on /routing id add or /routing id set.

RouterOS supports automatic router ID selection, and individual routing protocols can also be configured with explicit static IDs where needed. By default, the router selects the highest IP address from an operational interface. While convenient, this automatic selection can produce unexpected results when interfaces change state or IP addresses are modified. Explicit router ID configuration on the protocol instance ensures the identifier remains constant regardless of interface status changes.

The routing identity system also supports multiple named selection policies for scenarios requiring protocol-specific or instance-specific dynamic ID selection, such as when running multiple OSPF instances in different VRFs.

Router ID configuration in RouterOS is straightforward but requires understanding when and why explicit configuration is beneficial.

Create a routing identity entry and configure how dynamic selection should work:

/routing id add name=main
/routing id set [find name=main] select-dynamic-id=only-vrf select-from-vrf=main

The /routing id menu does not store a static router ID value. It controls how RouterOS picks a dynamic ID from interface addresses, and it does not accept dynamic-id=0.0.0.0 or any other manual dynamic-id value during configuration.

Automatic router ID selection is the default behavior when no explicit router ID is configured on a protocol instance. A routing identity can restrict that selection to a specific VRF:

/routing id add name=main
/routing id set [find name=main] select-dynamic-id=only-vrf select-from-vrf=main

If you do not create a /routing id entry at all, RouterOS still selects a router ID automatically. The routing identity entry only changes where that dynamic selection is taken from.

For scenarios requiring different dynamic-selection scopes for different protocol instances:

/routing id add name=ospf-main
/routing id set [find name=ospf-main] select-dynamic-id=only-vrf select-from-vrf=main
/routing id add name=ospf-customer-a
/routing id set [find name=ospf-customer-a] select-dynamic-id=only-vrf select-from-vrf=customer-a

Each routing identity can then be referenced by protocol settings that support named routing identity selection.

Router ID is most commonly configured explicitly for OSPF deployments. The router ID determines how the router identifies itself in OSPF LSAs and affects OSPF neighbor relationships.

When configuring OSPF, set the router ID directly on the instance:

/routing ospf instance add name=default
/routing ospf instance set [find name=default] router-id=10.0.0.1

Create the instance before using [find name=default], otherwise the set command silently matches nothing.

OSPF selects its router ID in the following order:

  1. Explicit router-id configured in the OSPF instance
  2. Automatically selected ID based on the router’s active interface addresses

When changing router ID on a running OSPF instance, the OSPF process must be restarted for the change to take effect:

/routing ospf instance disable [find name=default]
/routing ospf instance enable [find name=default]

Explicit router ID configuration is recommended for production networks for several reasons.

First, stability: Static router IDs remain constant regardless of interface state changes, preventing unexpected OSPF behavior when interfaces go up or down.

Second, predictability: Knowing the exact router ID simplifies troubleshooting and network documentation. When router IDs are auto-selected, interface changes can produce different IDs, complicating analysis.

Third, consistency: Explicit configuration ensures all routers in an OSPF domain have predictable, documented identifiers that can be referenced in runbooks and diagrams.

Finally, IPv4 addresses: Router IDs are 32-bit IPv4 addresses. While they do not need to be reachable or assigned to any interface, they should typically be from the private address space to avoid conflicts.

When OSPF fails to form neighbors or shows unexpected behavior, router ID is often the culprit.

Check the active router ID being used:

/routing ospf instance print
/routing id print

Router ID conflict: Ensure all routers in the same OSPF domain have unique router IDs. Duplicate router IDs prevent proper neighbor formation.

Router ID change requires restart: After changing router ID, always restart the OSPF instance to ensure the new ID is applied.

Zero router ID: If no router ID is configured and no interface has an IP address, OSPF cannot form neighbors. Ensure at least one interface has an IP address or configure a static router ID.