Route Tagging

Problem

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

Solution

RIP Version 2 allows you to tag external routes. For a static route, for example, the 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)#exit
Router1(config)#end
Router1#

 

Discussion

You can only apply a route tag 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 code 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)#exit
Router1(config)#router eigrp 65530
Router1(config-router)#network 192.168.1.0
Router1(config-router)#exit
Router1(config)#router rip
Router1(config-router)#redistribute eigrp 65530 route-map TAGGING
Router1(config-router)#exit
Router1(config)#end
Router1#

RIP does not make use of the tags directly; 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 were 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 can 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

And if we were to run a similar trace on a downstream router, we would see 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 allows 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)#exit
Router1(config)#end
Router1#

RIPv2 supports 16-bit tags, which gives a range of values between 0 and 65,535. As we discuss in Chapters 7 and 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.

See Also

Chapter 7; Chapter 8





Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net