Previous section   Next section

Recipe 6.16 Route Tagging

6.16.1 Problem

You want RIP to include a tag when it distributes specific routes to prevent routing loops when redistributing between routing protocols.

6.16.2 Solution

RIP Version 2 allows you to tag external routes. For example, a static route configuration looks like this:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1
Router1(config)#access-list 7 permit 0.0.0.0
Router1(config)#route-map TAGGING permit 10
Router1(config-route-map)# match ip address 7
Router1(config-route-map)# set tag 5
Router1(config-route-map)# exit
Router1(config)#router rip
Router1(config-router)#redistribute static route-map TAGGING
Router1(config-router)#end
Router1#

6.16.3 Discussion

You can apply a route tag only to external routes: that is, routes that are not learned from RIP. The example shows a static route, but you can apply a tag to routes learned from other routing protocols in exactly the same way. For example, the following shows how to apply a tag to certain routes learned via EIGRP:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#access-list 7 permit 192.168.1.0
Router1(config)#route-map TAGGING permit 10
Router1(config-route-map)# match ip address 7
Router1(config-route-map)# set tag 5
Router1(config-route-map)# set exit
Router1(config)#router eigrp 65530
Router1(config-router)#network 192.168.1.0
Router1(config-route-map)# set exit
Router1(config)#router rip
Router1(config-router)#redistribute eigrp 65530 route-map TAGGING
Router1(config-router)#end
Router1#

RIP does not make use of the tags, it only distributes them. Once a route has a tag associated with it, every RIP Version 2 router will propagate this tag with the route. Tags are useful when redistributing routes into another routing process. For instance, if our RIPv2 network was being used as a transit network between two other networks, we could tag routes learned from one of these external networks and redistribute only those routes into the other network. This way, the RIP network would allow the two networks to talk to one another, but neither of the external networks could use the internal resources of the RIP network itself.

A debug trace shows the tagging in action:

Router1#debug ip rip
RIP protocol debugging is on
Aug 13 03:27:23.870: RIP: sending v2 update to 224.0.0.9 via Serial0/0.2 
Aug 13 03:27:23.870: RIP: build update entries
Aug 13 03:27:23.870:    0.0.0.0/0 via 0.0.0.0, metric 1, tag 5
Aug 13 03:27:23.870:    172.22.0.0/16 via 0.0.0.0, metric 1, tag 0
Aug 13 03:27:23.874:    172.25.1.0/24 via 0.0.0.0, metric 1, tag 0
Aug 13 03:27:23.874:    172.25.25.1/32 via 0.0.0.0, metric 1, tag 0
Aug 13 03:27:23.874:    172.25.25.6/32 via 0.0.0.0, metric 2, tag 0

A similar trace on a downstream router would show that while the metric increments at each hop, the tag remains the same.

Here is an example that redistributes only the tagged routes into an attached EIGRP network. Note that you could easily construct a network where different tag values have different meanings. For example, you could make the tags equal to the routing process numbers of the various external networks. This would allow you to easily redistribute only the routes you want into other networks:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router eigrp 11
Router1(config-router)#redistribute rip route-map TAGOUT 
Router1(config-router)#exit
Router1(config)#route-map TAGOUT permit 10
Router1(config-route-map)#match tag 5
Router1(config-route-map)#route-map TAGOUT deny 20
Router1(config-route-map)#end
Router1#

RIPv2 supports 16-bit tags, which give a range of values between 0 and 65,535. As we discuss in Chapter 7 and Chapter 8, EIGRP and OSPF use 32-bit tags, for a range from 0 to 4,294,967,295. Of course, it is unlikely that you will need this many route tags.

6.16.4 See Also

Chapter 7; Chapter 8


  Previous section   Next section
Top