Redistribution of named and tagged static routes

Redistribute named and Tagged Static routesI always name my IOS static routes as a best practise. However I hit a syntax issue last week when I tried to combine the named static with a tag, then redistributing that tagged static route into OSPF. If you have issues redistributing a ‘named and tagged static’ then this may be the post for you.
The simplified config snippet below is configured on SW1 (cisco 3750X). This config will match all static routes tagged with ‘200’ and redistribute them into OSPF. I could have avoided this whole issue if I used a prefix list to match the routes, but I think tag-and-match is a more efficient and less-error prone approach.

router ospf 2 vrf FOO
redistribute static subnets route-map RM_VRF_FOO_STATIC2OSPF
route-map RM_VRF_FOO_STATIC2OSPF permit 10
match tag 200
set metric 20
route-map RM_VRF_FOO_STATIC2OSPF deny 10000

Then I added a static route with the name argument first and the tag second. I don’t show it here but this is valid syntax for routing and this route does appear as a valid route in the VRF routing table.

ip route vrf FOO name Foo_Via_Bar tag 200

But when I check for the Type-5 LSA in the database I don’t see my locally originated static.

SW11#sh ip ospf database | b Type-5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag 1400 0x80000005 0x0083F7 200

But when I modify the static route to add the tag first and the name second….

ip route vrf FOO tag 200 name Foo_Via_Bar

The redistribution code can match the tag, and create a Type-5 for it. You can see the redistributed route on line 5 below.

SW1#sh ip ospf database | b Type-5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag 5 0x80000001 0x00704A 200  ! YAY 1744 0x80000005 0x0083F7 200

Sherpa Summary

It’s a simple lesson, but easy to forget. If you’re tagging static routes and naming them, put the tag before the name.
Always check for the effect you want, not just that the configuration looks right.






Leave a Reply

Your email address will not be published. Required fields are marked *