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 allows administrators to configure explicit router identity values that routing protocols can use instead of automatically selecting an ID based on available IP addresses. This capability is essential for networks where deterministic router identification is required for operational consistency, troubleshooting, or compliance with specific network designs.

RouterOS supports both dynamically assigned and statically configured router IDs. When dynamic assignment is enabled, the router selects the highest IP address from any operational interface as its router ID. While convenient, this automatic selection can produce unexpected results when interfaces change state or IP addresses are modified. Explicit router ID configuration ensures the identifier remains constant regardless of interface status changes.

The routing identity system also supports multiple router IDs for scenarios requiring protocol-specific or instance-specific identification, such as when running multiple OSPF instances or when different protocols require different identifiers.

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

Set a static router ID:

/routing id add name=main dynamic-id=0.0.0.0
/routing id set [find name=main] static-id=1.1.1.1

The dynamic-id=0.0.0.0 indicates that automatic selection should not be used, while static-id specifies the explicit router ID value.

To use automatic router ID selection based on the highest interface IP:

/routing id add name=main dynamic-id=auto
/routing id set [find name=main] static-id=0.0.0.0

When dynamic-id=auto, the router selects the highest IP address from all active interfaces. This is the default behavior when no routing identity is configured.

For scenarios requiring different router IDs for different protocols:

/routing id add name=ospf-instance-1 dynamic-id=0.0.0.0 static-id=10.0.0.1
/routing id add name=ospf-instance-2 dynamic-id=0.0.0.0 static-id=10.0.0.2
/routing id add name=bgp-peer dynamic-id=0.0.0.0 static-id=10.0.1.1

Each routing identity can then be referenced by specific protocol instances.

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, the instance can reference a specific routing identity:

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

Alternatively, reference a named routing identity:

/routing id add name=ospf-main dynamic-id=0.0.0.0 static-id=10.0.0.1
/routing ospf instance set [find name=default] routing-id=ospf-main

OSPF selects its router ID in the following order:

  1. Explicit router-id configured in OSPF instance
  2. Router ID from referenced routing identity
  3. Highest IP address of any active interface

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.