OSPF Route Tagging

OSPF Route Tagging

When external routes are redistributed into OSPF, they might be assigned an OSPF route tag, which is a 32-bit value. It may be used to filter, match, or set route properties in other routing protocols as well as inside OSPF.

In other words, while the OSPF protocol does not utilize it, it may be used to filter, match, or set characteristics for routes in other routing protocols or inside OSPF.

The route tag can be used to prevent routing loops, define metrics, apply policies, or identify the source of the routes. In the OSPF router setup mode, you may configure the OSPF route tag by using the redistribute command with the tag keyword, or by using a route map with the set tag command.

OSPF route Tagging
Fig 1.1-OSPF route Tagging

If you want to tag the EIGRP routes with 12 when redistributing them into OSPF, you can use

NDNA_R1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
NDNA_R1(config)#router ospf 1
NDNA_R1(config-router)#redistribute eigrp 1 metric-type 1 subnets tag 12


NDNA_R1#show ip route
Routing entry for
  Known via "ospf 1", distance 110, metric 1500
  Tag 12, type extern 1
  Redistributing via ospf 12
  Last update from on Ethernet0, 00:07:14 ago
  Routing Descriptor Blocks:
  *, from, 00:07:14 ago, via Ethernet0
      Route metric is 1500, traffic share count is 1

Some of the basic troubleshooting commands in OSPF as below

  • show ip ospf - to verify the Router ID, area information, and SPF information
  • show ip ospf interface - to verify the OSPF area number and type
  • show ip ospf database - to view the OSPF link state database and the route tags
  • show ip route ospf - to view the OSPF routing table and the route tags
  • debug ip ospf events - to monitor OSPF events such as adjacency changes and SPF calculations

Some tips while configuring OSPF 

  • When setting OSPF, be sure to use a wildcard mask rather than a subnet mask.
  • On WAN links, ensure that IP addresses and subnet masks are appropriately established.
  • Serial connections connected through a DCE cable must be set with the clock rate command.
  • To construct an adjacency, OSPF routers must have the same hello and dead timings.
  • To build an adjacency, OSPF routers must use the same authentication type and key.
  • To build an adjacency, OSPF routers must have the same MTU size.

Some use cases and scenarios for OSPF route tag are
  • When redistributing routes into or out of OSPF, filter OSPF routes depending on the tag value.
  • When redistributing routes across various routing protocols, to avoid redistribution loops or undesirable routes.
  • In OSPF, determine the source or kind of external routes.
When redistributing OSPF routes back into EIGRP, for example, you may use a route tag to filter out EIGRP routes that have been redistributed into OSPF. Alternatively, you may use a route tag to differentiate between OSPF external type 1 and type 2 routes.

Some best practices and recommendations for OSPF route tag are
  • For each route source or type, use a consistent and relevant tag value.
  • Use route maps to regulate route redistribution depending on tag value.
  • To avoid unauthorized route injection, use distinct OSPF authentication for each neighbor.
  • To eliminate unwanted OSPF adjacencies, use accurate network design and the default passive interface.
  • Reduce the size of the OSPF database and routing table by using summarization techniques.

Continue Reading...