OSPF Dynamic Routing · Topic 4 of 8

External Routes and Metric Types 1 and 2

Learn how OSPF redistributes outside routes, how external type 1 and type 2 metrics are calculated, and how to configure redistribution in RouterOS.

  • 5 min
In a nutshell
  • An AS boundary router redistributes outside routes into OSPF as external LSAs.
  • In v6, redistribute-* takes as-type-1, as-type-2 or no.
  • Type 1 adds the internal cost to the ASBR to the external metric.

What it is

External routes are routes that come from outside OSPF, such as static, connected or other protocol routes, injected by an AS boundary router.

The ASBR takes these routes, gives them a metric, and floods them as external LSAs. The rest of the network learns them as OSPF routes and can use them like any other.

An external route has one of two metric types. They differ in how the cost to reach the destination is calculated.

Static route0.0.0.0/0redistributeASBRtype 1 or type 2external LSAInternal routerscalculate cost

How it works

The ASBR redistributes routes with a chosen metric type, and every other router adds up the cost in a way that depends on that type.

Redistribution in RouterOS v6

The instance has a setting for each source of routes. The value chooses the metric type, or turns redistribution off.

/routing ospf instance set [find default=yes] redistribute-connected=as-type-1 redistribute-static=as-type-2
/routing ospf instance set [find default=yes] originate-default=if-installed-as-type-2

The values are as-type-1, as-type-2 and no. There are similar settings for routes from RIP, BGP and other OSPF instances. A metric for the redistributed routes can also be set in the instance.

The originate-default setting makes the router advertise a default route into OSPF. The values are never, if-installed-as-type-1, if-installed-as-type-2, always-as-type-1 and always-as-type-2. With an if-installed value, it advertises the default route only while it has one of its own. With an always value, it advertises one regardless. The type in the value is the external metric type of that default route.

In RouterOS v7, redistribution is configured on the instance with a list of sources, and the details of the metric type differ. Check the v7 menu before relying on the v6 names.

External type 1

With type 1, the cost of the route is the external metric plus the internal OSPF cost to reach the ASBR. The cost grows as the route travels further from the ASBR.

This is the right choice when several ASBRs advertise the same destination and routers should choose the nearest exit.

External type 2

With type 2, the cost is the external metric only. The internal cost to the ASBR is not added, so every router sees the same cost for the route.

If two type 2 routes have the same external metric, the router compares the internal cost to the ASBR as a tie breaker. Type 2 suits a single exit point, where the path inside OSPF does not matter.

FeatureType 1Type 2
Cost seen by a routerExternal metric plus internal cost to ASBRExternal metric only
Cost changes with distanceYesNo
Best forSeveral exits, nearest winsOne exit or equal treatment

Preference between types

When a router learns the same prefix in different ways, it prefers them in a fixed order. Routes inside the area win, then routes from other areas, then external type 1, then external type 2.

This means a type 1 route beats a type 2 route to the same destination, whatever the metric values.

ASBR 1metric 20internal cost 10Routertype 1 cost is 30ASBR 2metric 20internal cost 50Routertype 1 cost is 70

In this example the router picks ASBR 1 for a type 1 route, because the total is lower. With type 2, both would show a cost of 20, and the tie breaker would pick the nearer ASBR.

Where external routes do not go

External LSAs of type 5 are flooded across the whole domain, but not into stub areas. In an NSSA, the ASBR uses type 7 LSAs instead. These cases are covered in the page on stub and NSSA areas.

Verifying

/routing ospf lsa print
/ip route print

Look at the cost and the type shown for the route. The LSA list shows the external LSAs that the ASBR originated.

Exam tip

Use type 1 when several ASBRs offer the same route and distance should count. Use type 2 for a single exit.

What to remember for the exam

Seven facts cover most questions on this topic.

  • An AS boundary router redistributes outside routes into OSPF as external LSAs.
  • In v6, redistribute-* takes as-type-1, as-type-2 or no.
  • Type 1 adds the internal cost to the ASBR to the external metric.
  • Type 2 uses only the external metric, and the internal cost is a tie breaker.
  • Type 1 routes are preferred over type 2 routes to the same prefix.
  • originate-default advertises a default route into OSPF.
  • Type 5 external LSAs do not enter stub areas.
Watch out

Redistribution without a plan can create loops, especially when two routers redistribute in both directions.

Common mistakes

These four errors appear often.

Expecting type 2 to reflect distance. Every router sees the same cost, so the closest exit is not chosen by cost.

Mixing types for one prefix. A type 1 route always beats a type 2 route, so the metric values are never compared.

Redistributing without a default route to match. An if-installed value of originate-default does nothing when the router has no default route.

Reading the v6 names on a v7 router. The redistribution settings changed, so use the v7 menu.

Check yourself

Work through these three questions.

  • How is the cost of an external type 1 route calculated?

    It is the external metric plus the internal OSPF cost to reach the ASBR. The cost grows with distance.

  • What is different about external type 2?

    The cost is the external metric only, so all routers see the same value. The internal cost to the ASBR is used only as a tie breaker.

  • Which RouterOS settings turn on redistribution of static routes as type 2 and advertise a default route?

    In v6, set redistribute-static=as-type-2 on the OSPF instance. Add originate-default to advertise a default route.

Topic 4 of 8 in OSPF Dynamic Routing

Test yourself on OSPF Dynamic Routing

The full MikroTik MTCRE question bank has 417 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.