Configuring Anycast RP
Problem
You want to configure two or more RPs and have your routers simply use whichever one is closest.
Solution
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 10.4.4.4 255.255.255.255
Router-RP1(config-if)#exit
Router-RP1(config)#interface Loopback1
Router-RP1(config-if)# ip address 192.168.99.1 255.255.255.255
Router-RP1(config-if)# ip pim sparse-dense-mode
Router-RP1(config-if)#exit
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 10.5.5.5 connect-source Loopback0
Router-RP1(config)#access-list 22 permit 239.0.0.0 0.255.255.255.255
Router-RP1(config)#end
Router-RP1#
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 10.5.5.5 255.255.255.255
Router-RP2(config-if)#exit
Router-RP2(config)#interface Loopback1
Router-RP2(config-if)# ip address 192.168.99.1 255.255.255.255
Router-RP2(config-if)# ip pim sparse-dense-mode
Router-RP2(config-if)#exit
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 10.4.4.4 connect-source Loopback0
Router-RP2(config)#access-list 22 permit 239.0.0.0 0.255.255.255.255
Router-RP2(config)#end
Router-RP2#
Discussion
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 192.168.99.1, 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.
|
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.