Skip to main content
vponmuniraj
Staff
Staff
February 22, 2021

Technical Tip: Configure OSPF route tag for redistributed prefixes

  • February 22, 2021
  • 0 replies
  • 6112 views
Description
This article describes how to tag routes distributed by OSPF.

Solution
The example below shows commands used for redistributing static routes with a tag of 1003.

Create an access list for the prefix(s).
# config router access-list
    edit "static_redistribute"
        # config rule
            edit 1
                set prefix 10.147.7.49 255.255.255.255
                set exact-match enable
            next
        end
    next
end
Create a route map to match the prefix list configured above and set the tag.
# config router route-map
    edit "Static_redistribute"
        # config rule
            edit 1
                set match-ip-address "static_redistribute"
                set set-tag 1003
            next
        end
    next
end
Configure the route map under the redistribute statement.
# config router ospf
    # config redistribute "static"
        set status enable
        set routemap "Static_redistribute"
    end
end
To verify the tag, use the command below.

Before.
Vigneshp # get router info ospf  database  self-originate

Link ID         ADV Router      Age  Seq#     CkSum Flag Route              Tag
10.147.7.49     10.5.20.66      3    80000218 3853  0021 E2 10.147.7.49/32  0     <-----
After.
Vigneshp # get router info ospf  database  self-originate
                AS External Link States

Link ID         ADV Router      Age  Seq#     CkSum Flag Route              Tag
10.147.7.49     10.5.20.66      1169 80000217 0499  0031 E2 10.147.7.49/32  1003   <-----