Configuring Anycast RP


You want to configure two or more RPs and have your routers simply use whichever one is closest.


One of the most significant shortcomings of PIM-SM is that within any given multicast network boundaries, there can be only one RP for any multicast group. This has several potential problems including slow convergence after an active RP failure and potentially extra hops required to reach a distant RP. Anycast RP solves these problems.

The first RP configuration looks like this:

Router-RP1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router-RP1(config)#ip multicast-routing
Router-RP1(config)#interface Loopback0
Router-RP1(config-if)# ip address
Router-RP1(config)#interface Loopback1
Router-RP1(config-if)# ip address
Router-RP1(config-if)# ip pim sparse-dense-mode
Router-RP1(config)#ip pim send-rp-announce Loopback1 scope 16 group-list 22
Router-RP1(config)#ip pim send-rp-discovery Loopback1 scope 16
Router-RP1(config)#ip msdp peer connect-source Loopback0
Router-RP1(config)#access-list 22 permit

The configuration for the second RP router is almost identical:

Router-RP2#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router-RP2(config)#ip multicast-routing
Router-RP2(config)#interface Loopback0
Router-RP2(config-if)# ip address
Router-RP2(config)#interface Loopback1
Router-RP2(config-if)# ip address
Router-RP2(config-if)# ip pim sparse-dense-mode
Router-RP2(config)#ip pim send-rp-announce Loopback1 scope 16 group-list 22
Router-RP2(config)#ip pim send-rp-discovery Loopback1 scope 16
Router-RP2(config)#ip msdp peer connect-source Loopback0
Router-RP2(config)#access-list 22 permit



RFC 3446 describes this simple but clever idea for use with PIM-SM. The key is to configure the same IP address on the Loopback interfaces of two different RP routers and to distribute this address through a dynamic routing protocol. Then the routing protocol will ensure that the "closest" RP is selected.

The only tricky part is that a source may prefer to use one RP, while a destination may be closer to the other one. In this case, since the source is not registered with the RP selected by the recipient device, the RPs must have a mechanism for knowing about the groups supported by one other. Fortunately, there already exists such a mechanism, MSDP, which we discussed in Recipe 23.17.

In Recipe 23.17 we used MSDP between two BGP Autonomous Systems, but MSDP can also function within a single AS. In fact, the MSDP configuration for Anycast RP operation just involves defining a peer relationship between the RP routers.

Notice that in this recipe we have used an Anycast RP IP address of, which we have assigned to interface Loopback1 on both RP routers. This address will be distributed through the unicast routing protocol. While it is preferable for stability to do the MSDP peering between loopback interfaces, it is critical that it be a different interface from the one containing the Anycast RP address. This is because the MSDP peer addresses must be unique, while the Anycast RP addresses must be the same on both RPs.

In the example, we have used AutoRP to distribute the RP information. However, you could just as easily use static RP definitions with the ip pim rp-address command or the Bootstrap Router method.

Unfortunately, because the Anycast RP method requires routers to be able to select the appropriate RP on the fly for each group, it does not work with Bidirectional PIM, which pre-builds its RP rooted RPF trees.

One final note on the Anycast RP technique is worth bearing in mind. Each individual multicast router will use its unicast routing table to determine which RP is the closest. Exactly the same route selection rules are used for building multicast routing trees as for unicast routing. Specifically, the router will take the longest prefix match first, and use the Administrative Distance and then the route metric to break any ties.

This means that there are three cases when your routers may select a different RP than the one you expect. First, if you have two or more routing protocols in operation, you will need to watch your Administrative Distances. Second, if the two RPs turn out to have exactly the same metric, the router will alternate between them. Third, if you have unequal cost load balancing enabled, the router will select the RP in a more complicated weighted round robin fashion.

The good news is that in each of these cases, MSDP will always direct Join requests to the appropriate RP. But troubleshooting can become somewhat complicated if you don't know which RP you are using.

In the future, the MSDP part of this configuration may become unnecessary. Cisco has been working on an extension to PIM-SM that will allow a group of RP routers sharing a Loopback IP address to automatically forward Source Active Registration messages to one another. This method is documented in RFC 4610, although the feature has not been added to the main line 12.4 IOS version yet.

See Also

Recipe 23.2; Recipe 23.3; Recipe 23.17; RFC 4610

Router Configuration and File Management

Router Management

User Access and Privilege Levels


IP Routing





Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time


Router Interfaces and Media

Simple Network Management Protocol





First Hop Redundancy Protocols

IP Multicast

IP Mobility




Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications


Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505 © 2008-2020.
If you may any questions please contact us: