PIM Introduction
05 June 2025 16:23
PIM: Protocol Independent Multicast
Multicast routing enables a source in one VLAN to stream to receivers in multiple VLANs.
PIM leverages unicast routing information, to forward messages to receivers. The process of
determining where the multicast messages are to be sent is referred to as building the tree.
In IPv4: IGMP determines who needs to receive a multicast stream and PIM determines who to get
the streams to those destinations.
Multicast Tree:
The primary purpose is to build an efficient loop-free forwarding path from the source of the
multicast stream toward all the receivers.
Root: Router closest to the source
Leaf: Router with an attached receiver
Multicast Routing Page 1
Leaf: Router with an attached receiver
Branch: Intermediate router that performs replication to connect the root to the leaves
An active multicast route is called an (S,G) route because it has a source and a multicast group
address.
PIM uses Reverse Path Forwarding (RPF) to save bandwidth and maximize efficiency.
IGMP is a host-to-router communications so routers can discover which receivers need a
particular stream and which receivers do not.
PIM is a router-to-router communication, so multiple routers can build a shortest path tree (SPT)
for a multicast stream.
There are two ways to build distribution:
Multicast Routing Page 2
- PIM-DM vs PIM-SM:
1- PIM Dense Mode (DM):
Assumes everyone wants to receive the stream (Push concept). PIM-DM enabled VLAN interfaces
flood multicast streams to all neighbors. It continues until neighbors send a Prune message.
Upstream neighbors set a timer for the pruned interface when the timer expires it reverts to the
default behavior (forwarding multicasts until requested not to).
This mode is best for high bandwidth and high tolerance for congestion.
2- PIM Sparse Mode (SM):
Assumes nobody wants to receive the stream (Pull concept). It builds the multicast routing tree
for a group in advance and then forwards multicasts on that tree when a source beings to stream
to that group. PIM-SM enabled routing interfaces must indicate that they want to receive multicast
traffic. If its upstream neighbor does not receive joins, it reverts to its default behavior (Not
forwarding traffic)
This mode is best for lower-bandwidth environment.
- PIM Hello Messages:
Routers and L3 switches send periodic Hello messages on PIM-enabled interfaces to discover
neighbors (Src IP of outgoing interface) and sent to all PIM routers with multicast destination
([Link]).
Hello messages contain:
• Hello period time: Used to elect a DR (A single PIM router that acts on behalf of directly
connected hosts in a shared media
• Hello hold time: signifies how long the neighbor will keep the neighbor relationship without
receiving an update.
• LAN prune delay time and capabilities.
- Behavior:
PIM is disabled by default and can be configured within a VRF at a time (all interfaces in VRF must
run same mode).
PIM uses unicast routing information routing protocols / Static route.
PIM can be enabled across all VRFs on a maximum of 1000 interfaces with an upper limit of 128
per VRF.
PIM currently does not support:
• VXLAN, 6in4, 6in6, and GRE interfaces
• Active-active functionality in VSX isn't available.
Multicast Routing Page 3
Multicast Routing Page 4
PIM-DM
08 June 2025 16:51
PIM-DM must be enabled on all VLAN interfaces between the multicast sources and the multicast
receivers:
• Interfaces on which multicast sources reside.
• Interfaces on which multicast receivers reside (IGMP-enabled interfaces)
• Interfaces between all routers and routing switches that connect sources and receivers.
To configure PIM-DM it should be enabled globally then configured on the appropriate VLAN
interfaces.
Hello packets automatically discover neighbors and sent to [Link] every 30 seconds (Default).
Range can be configured between 5-300 seconds. Hello timer is used to calculate the hold timer.
BFD can speed up the convergence of PIM. If globally enabled, BFD is automatically enabled for PIM
interfaces where PIM is also enabled.
The switch creates (*,G) entry for each group membership discovered by IGMP on that VLAN.
The (*,G) entry exists only as a pending route. It remains in the PIM routing table as long as IGMP
membership for the group exists on at least one interface.
Multicast Routing Page 5
Situations where (*,G) is visible:
• Purge has occurred, so the switch generates a graft message and sends it to its upstream
neighbors to find the source so the traffic can be flooded back to the switch.
• If there is a network issue where the source is no longer reachable and thus no multicast
stream is received, yet the switch still has clients locally or downstream that desire to receive
the stream.
To view information about IGMP groups, enter "show ip igmp groups" or "show ip igmp group"
(S,G) entry is created when a switch receives a multicast on the proper upstream interface for the
source. If the (S,G) has downstream interfaces or if the source is connected directly to the routing
switch. The routing switch adds the (S,G) entry to its active multicast routing table.
Multicast Routing Page 6
To prevent prune time-out, the source-connected switch floods state refresh messages on all PIM-
DM messages which indicates states, triggering all PIM-DM routers to send joins and prunes only if
they need to change the current state of the upstream interface.
State refresh message triggers PIM-DM interfaces to do:
• Drop messages unless it has arrived from the RPF upstream neighbor.
• For messages from the proper upstream neighbor:
○ Check the indicated state of the upstream interface and determine whether it matches this
routing switch's requirements.
○ If the indicated state is pruned and this routing switch has no downstream interfaces for
the (S,G) entry, the indicated state is correct. If indicated state is forwarding and this
routing switch does have downstream interfaces on which it must forward traffic, the state
is correct.
○ If the indicated state is pruned and this switch requires the multicasts, the switch sends
(S,G) join upstream to alter the state. If the indicated state is forwarding, but this switch
does not have an active entry forwarding multicast traffic downstream, the switch sends
an (S,G) prune upstream.
○ Reset all pruned interface timers. The switch can safely reset all timers because its
downstream neighbors will correct any mistakes on receipt of the state refresh message,
just as this routing switch did.
○ Forward the state refresh message (with one less value in the Time to Leave) on all
interfaces with PIM-DM neighbors except the interfaces on which it received the message.
The TTL prevents the state refresh message from endlessly looping through the PIM-DM
domain.
Only the routing switch connected directly to the unicast source initiates state refresh messages.
Multicast Routing Page 7
The PIM routers send an assert message to elect a forwarder, then examine each other's asserts to
elect a multicast forwarder for the interface.
The election winner:
• Has OSPF route to source.
• Admin distance.
• Best OSPF metric.
• Highest priority.
• Higher IP address.
Multicast Routing Page 8
Multicast Routing Page 9
PIM-SM
11 June 2025 10:42
The PIM DR manages state information and PIM updates for all the routers on the segment. Selection
process occurs when all neighbors on a segment have replied to PIM hello messages. Each router on a
segment selects one router to function as DR. The highest priority is selected as the DR. The priority is
configurable and send in PIM Hello messages if the priority (Default 1) is the same then the highest IP
address.
When the DR receives an IGMP membership report message from a receiver for a new group or source,
the DR creates a tree to connect the receiver to the source by sending a PIM join message out the
interface toward the agreed-upon root of the multicast tree, the Rendezvous Point.
Rendezvous Point (RP) is a router that has been configured to be used as the root of the nonsource-
specific distribution tree (shared tree) for a multicast group.
Receivers discover sends and start to receive traffic destined for the group by making a rendezvous point
Multicast Routing Page 10
Receivers discover sends and start to receive traffic destined for the group by making a rendezvous point
at the RP router.
RP router is not a packet source but a location from which to root and calculate a loop-free topology. RP
router should be close to the source if possible. This is only applicable to a few sources that are of key
importance to the business.
Two types of tree are used:
• Source Tree (Shortest Path Tree): The root of the source tree is the router closest to the source. The
tree extends from the root router in a direct path toward all the group members.
Each router must calculate the tree independently based on the information it has received (PIM,
RPF, etc.) and create Outgoing Interface List (OIL) from the best paths (unicast).
• Shared Trees (Rendezvous Point Tree): The RP is the root of the tree. Each router still uses RPF
checks to keep the topology loop-free (direction of RP not source).
The advantage is that all non-RP routers can conserve control plane resources during stream
establishment or during host maintenance.
- PIM-SM Group States:
• (*,G): Mroute table Represents a leave of a tree. All leaf-facing interfaces are added to an outgoing
interface list. Used in RPT because routers have a preconfigured meeting point (RP). The routers only
Multicast Routing Page 11
interface list. Used in RPT because routers have a preconfigured meeting point (RP). The routers only
need one interested receiver to build the tree.
• (S,G): Mroute table represents relationship to the source of the multicast stream. Used in shortest
path trees. (multicast group and source IP are needed).
- PIM-SM Build-Up Process:
Phase 1 - Rendezvous Point Tree:
1. Receiver sends IGMP join request to Last-Hop Router (LHR) which includes Multicast group. First
Hop Router creates multicast state (*,G) is created and adds receiver-facing interface OIL.
2. LHR sends a PIM join to RP:
a. LHR uses RPF to determine next-hop to RP (unicast).
b. Join messages are sent periodically to maintain the multicast state.
3. Intermediate routers between (LHR and FHR) add a (*,G) state and forward PIM join to the RP.
4. Source sends stream to FHR and adds (S,G) state to mrouting table.
5. Intermediate routers doesn't have (S,G) state and thus will drop traffic and to fix this problem the
stream will be encapsulated inside a unicast packet with IP of RP as IP destination. This is known as
(PIM register products).
6. (Conclusion): When the RP receives the PIM register message and checks for present (*,G) entry in
mrouting table.
a. If there is a receiver: Decapsulate and forward onto the shared tree.
b. If there is no receiver: RP sends a Register stop message to the FHR. Each router maintains a
register suppression timer that is initiated by Register stop message. Upon expiration of this
timer, the FHR sends a register packet to the RP again to verify if there are any active receivers
for that group.
The flow in this phase is inefficient.
Phase 2 - Register Stop:
Multicast Routing Page 12
1. FHR receives a source-specific PIM join from RP which adds (S,G) to FHR and to intermediate routers
in the path eliminating the need for the encapsulation process.
2. FHR can send native multicast traffic.
3. RP receives two copies of the same traffic, one encapsulated in the Register message and other
natively received. The RP discards the encapsulated copy.
4. RP sends a PIM register stop to FHR.
5. RP receives multicast traffic from the source with no encapsulation and forwards this traffic to the
LHR which creates a new (S,G) state on all routers between RP and LHR.
This phase results in removal of overhead but the traffic might travel long distance to reach receiver.
Phase 3 - Shortest Path:
1. LHR knows the multicast src IP and uses RPF to find a best path if a path is found then optimization
will begin
2. LHR initiates a transfer from the shared tree to the SPT. The LHR sends a PIM join message (S,G) to
the FHR.
3. FHR receives PIM messages and forwards multicast packets to the LHR via the best path.
4. LHR receives two copies of the traffic, one from the RP using the shared tree and the other from the
source using the SPT.
5. The LHR sends a PIM Prune toward the RP
- Static RP:
Multicast Routing Page 13
Every device should be told the IP of the RP including the RP itself.
If a group address is not specified, it applied to all IPv4 multicast addresses. PIM supports up to 8 static
RPs per VRF.
- Dynamic RP and the BSR:
BSR is an RP high-availability mechanism that provides active/standby functionality and automatic
downstream RP information propagation. Establishes a method to share group-to-RP mappings (RP-Set)
to all PIM routers in the domain. This mechanism avoids wrong mappings that can cause unexpected
problems.
BSR can be used to configure routers within a PIM domain to be potential RPs known as Candidate RPs (C-
RPs) and BSR can be used to configure PIM routers in the domain to be domain bootstrap routers or
candidate-BSRs (C-BSRs)
One C-BSR is elected to be the BSR for the domain. All PIM routers in the domain learn the result of
election using bootstrap messages. The C-RPs then report the candidacy to the elected BSR.
Multicast Routing Page 14
BSR Mechanism
11 June 2025 16:55
Phase 1 - BSR Election:
Function of the BSR is to collect and broadcast the RP set to all routers in the domain.
Each C-BSR originates BootStrap Messages (BSMs) announcing the capacity to become a BSR. The BSM
contains a BSR priority field. A C-BSR that receives a higher priority stops sending BSMs for a period of
time. If the priority is the same then the highest IP address is elected.
There are three states during the BSR election:
• Candidate-BSR (C-BSR): A candidate to be the BSR for the scope zone but another router is the
preferred BSR.
• Pending-BSR (P-BSR): Temporary state that prevents rapid thrashing of the choice of BSR during
BSR election. It is a candidate to be BSR and no other router Is the preferred BSR.
• Elected-BSR (E-BSR): The router is the elected BSR for the scope zone and must perform all BSR
functions.
Phase 2 - C-RP Advertisement:
Each candidate-RP sends periodic candidate-RP-Advertisement (C-RP-Adv) messages to the elected BSR.
It includes priority and a list of group ranges for which the candidacy is advertised which allows learning
about possible RPs that are currently up and reachable.
Phase 3 - RP-Set Formation:
Multicast Routing Page 15
The BSR selects a subset of the C-RPs which it has received C-RP-Adv messages to form the RP-set and
it shouldn't be too small or too large and attempt to produce an RP-Set that does not change frequently.
Phase 4 - RP-Set Flooding:
When a PIM router receives a BSM it adds the group-to-RP mappings contained therein to its pool of
mappings obtained from other sources. It calculates the final mappings using the figure above.
In future BSMs, the BSR includes the RP-set information. BSMs are flooded through the domain, which
ensures that the RP-Set rapidly reaches all the routers in the domain.
Multicast Routing Page 16
VSX and PIM
12 June 2025 10:14
- Behavior:
VSX peers have the same control plane information as both members can establish PIM neighborships,
send PIM JOIN/LEAVE to RP, Populate (S,G) entries and built an SPT.
Data plane is only routed from the VSX peer that acts as the PIM DR. Multicast entries in DR are written
as route entries and the entries in the proxy DR as bridge entries.
VSX supports fast failover in case the PIM DR fails. Once the VSX peer acting as DR goes down, the proxy
DR detects the ISL status and removes the PIM neighborship of the VSX peer immediately.
The proxy DR becomes the DR and the bridge entries for downstream VSX ports to route entries.
When the VSX peer is back online it assumes the proxy DR role and starts to learn about multicast
routes. To prevent the new proxy DR to return as DR again after the reboot (due to higher IP) the current
DR sends hello packets with the highest DR priority. Any user-configured DR priority is ignored
Multicast Routing Page 17
If the ISL goes down with the VSX keepalive present and both VSX peers are up, the VSX primary stays
as the DR. The secondary VSX becomes proxy DR when its downstream links are cut by VSX
infrastructure.
If ISL goes down and keepalive is not configured, both VSX peers act independently and the downstream
VSX ports are not brought down but results in duplicate traffic since both VSX peers start acting as DR.
Multicast Routing Page 18