PIM General

PIM stands for Protocol Independent Multicast - a name that describes it well. PIM is protocol independent, meaning that it relies on an underlying unicast routing table to locate unicast addresses and does not concern itself with how or why the unicast routing table was built.

The current version of PIM is PIMv2. Version 1 encapsulates its messages with protocol number 2 (IGMP) and uses the multicast address 224.0.0.2. PIMv2 uses its own protocol number of 103 and uses the reserved multicast address 224.0.0.13. PIMv2 is backwards compatible with PIMv1, and a PIMv2 router will automatically use PIMv2 on an interface that connects to a PIMv1 router.

PIM-DM and PIM-SM elect a designated router (DR) on multiaccess networks. It doesn’t do it for itself, but rather for IGMPv1 who relies on PIM for the Querier process. The PIM router with the highest IP address becomes the DR. The other PIM routers on the segment monitor the Hello messages of the DR, and if they do not hear those Hellos for 105 seconds, they elect another DR.

On a shared segment such as Ethernet, there lies the possibility that a downstream router could send a Prune message to the upstream router while there is another router on the segment that does have multicast subscribers to the group being pruned. PIM handles this problem with a process called prune override. When the upstream router receives a Prune message, it waits 3 seconds to see if it receives a Join from another neighbor before truly pruning the group. The other routers on the segment would know to send a Join as they would hear the Prune message sent to the upstream router.

PIM routers also elect a single forwarder on multiaccess networks. SInce PIM doesn’t have its own routing protocol, it uses Assert messages to select the forwarder. The Assert message includes the source and group address, the metric of the unicast route to the source, and the metric preference (in IOS terms, the administrative distance) of the unicast protocol used to discover the route. The routers producing the duplicate packets compare the messages and determine the forwarder based on the following criteria:

  • The router advertising the lowest metric preference (administrative distance) is the forwarder.
  • If the metric preferences are equal, the router advertising the lowest metric is the forwarder.
  • If both the metric preferences and the metrics are equal, the forwarder is the router with the highest IP address on the network.

PIM-DM (PIM Dense Mode)

PIM-DM uses 5 PIMv2 messages:

  • Hello
  • Join/Prune
  • Graft
  • Graft-Ack
  • State Refresh
  • Assert

PIMv2 routers use Hello messages to discover neighbors. PIMv1 routers do not have a Hello message, so they use a Query message to discover neighbors. Both messages are sent out every 30 seconds by default in IOS and both can be changed with the interface command ip pim query-interval. The hold time (oddly) is set to 3.5 times the Hello/Query interval.

When a multicast source begins sending packets, PIM-DM uses flood-and-prune to build the multicast source tree (S, G). Note PIM calls these shortest path trees. Ultimately with the flooding, multicast packets reach all leaf routers, that is routers that have no downstream PIM neighbors. If a leaf router recieves a multicast packet for which it has no attached group members, the router must prune itself from the multicast tree. It does this by sending a Prune message to the upstream neighbor toward the source. The destination address of the Prune message is 224.0.0.13, and the address of the upstream router is encoded within the message. If that upstream neighbor has no attached members of the packet’s group, and either has no other downstream neighbors or has received prunes from all its downstream neighbors, it sends a Prune message to its own upstream neighbor toward the source.

PIM-DM maintains the prune state for all interfaces. The reason for this requirement is so that a router that has pruned itself from a multicast tree can graft itself back onto the tree when necessary. If a receiver requests to join a multicast group after the shared tree has been built and the receiver’s router is a leaf router that pruned itself due to no group members, then the leaf router will send a PIM Graft message upstream toward the source. But, and this is the key to understanding why prune-state must be maintained, the only way the leaf router will know the unicast address of the source is from the initial flooding of multicast packets.

The Graft message is unicast to the upstream neighbor on the group tree. When the upstream router receives the Graft message, it adds the interface on which the message was received to its outgoing interface list. The interface is put into forward state, and a Graft Ack message is immediately unicast to the new downstream neighbor. If the router is already forwarding packets to other downstream neighbors, nothing else must be done. But if the router has also pruned itself from the tree, it too must send a Graft to its upstream neighbor. When a router sends a Graft message, it waits 3 seconds for a Graft Ack. If the acknowledgment is not received within that time, the router retransmits the Graft message.

PIM DM works fine in small networks with a lot of subscribers. However, it has one inherent scalability limitation: excessive flooding. Every Pruned interface state expires in 3 minutes by default, and then flooding out of this interface resumes again, until the upstream does not receive another PIM Prune message on the interface. This is needed to ensure that no node in the network potentially misses multicast traffic. This periodic flood and prune behavior is what makes PIM Dense mode non-scalable.

The obvious benefit of PIM DM is its “plug-and-play” behavior. As soon as you configure PIM DM in your network, you can start sending multicast traffic, and the traffic is flooded to all interested subscribers.