PIM-SM
PIM-SM
Section titled “PIM-SM”Protocol Independent Multicast - Sparse Mode (PIM-SM) is a scalable multicast routing protocol that enables efficient data distribution from senders to receivers spread across multiple network segments. Unlike dense-mode protocols that flood traffic throughout the network, PIM-SM uses a pull-based model where receivers explicitly join multicast groups, making it suitable for wide-area networks and sparse receiver distributions.
PIM-SM is “Protocol Independent” because it does not require a specific unicast routing protocol. It operates on top of any existing unicast routing infrastructure, whether OSPF, BGP, static routes, or any combination thereof. This flexibility allows multicast deployment in networks using any unicast routing strategy.
RouterOS implements PIM-SM to support enterprise multicast applications including video conferencing, IPTV distribution, financial data feeds, and software updates. The implementation supports both IPv4 and IPv6 multicast, enabling deployment in modern dual-stack network environments.
Summary
Section titled “Summary”IP Multicast is a technology that allows efficient data distribution to multiple recipients over a network. Senders transmit to a specific multicast IP address, and receivers indicate their interest in receiving data sent to that address. The network infrastructure then replicates and delivers data from senders to interested receivers without requiring the sender to maintain individual connections.
When senders and receivers reside on the same local network segment, routers are not required for multicast delivery. Communication occurs directly between hosts, and this process can be enhanced through IGMP snooping switches that optimize local multicast traffic. However, when senders and receivers are separated by network boundaries, a multicast routing protocol becomes essential to establish paths for data transmission.
PIM-SM addresses the challenges of multicast routing in sparse receiver environments. Sparse mode means that multicast data is delivered only to network segments where receivers have explicitly joined the group, avoiding the flood-and-prune behavior of dense-mode protocols. This approach dramatically reduces unnecessary traffic in networks where few hosts subscribe to multicast groups.
The protocol relies on two key components: First, routers must discover local receivers on their directly connected segments. For IPv4, this function is provided by the Internet Group Management Protocol (IGMP), while IPv6 uses Multicast Listener Discovery (MLD). Second, routers must exchange multicast routing information to build distribution trees connecting senders to receivers across the network.
RouterOS v7 includes PIM-SM configuration in the main system package, simplifying deployment for modern installations. Older RouterOS versions require an additional multicast package to be installed. The feature is not available on SMIPS devices including hAP lite, hAP lite TC, and hAP mini.
Introduction
Section titled “Introduction”Multicast routing presents unique challenges compared to unicast routing. In unicast routing, each destination has a specific path from any source. In multicast routing, a single source may need to reach multiple receivers, potentially through different paths. The network must efficiently replicate packets at branch points while maintaining optimal paths from sources to receivers.
PIM-SM solves these challenges using a shared tree architecture anchored at a Rendezvous Point (RP). All multicast traffic initially flows through the shared tree, which provides a common distribution structure that any sender can use to reach any receiver in the group. As traffic patterns establish themselves, routers can optionally switch to shortest-path trees originating directly from sources, optimizing delivery paths for high-bandwidth or frequent streams.
The shared tree approach offers significant advantages for networks with sporadic multicast sources. Rather than maintaining source-specific state for every potential sender, routers only need to maintain state for active multicast groups. This scales efficiently to support thousands of multicast groups with relatively few active sources.
How PIM-SM Works
Section titled “How PIM-SM Works”PIM-SM operates through a series of exchanged messages that build and maintain multicast distribution state throughout the network. The primary message types include Hello messages for neighbor discovery and maintenance, Join/Prune messages for group membership signaling, Bootstrap messages for RP election, and Register messages for initial source registration.
When a PIM-SM router initializes, it discovers neighboring PIM-SM routers through Hello messages exchanged on all configured interfaces. These Hello messages advertise router capabilities including priority values used in DR and BSR elections. Neighbors form adjacencies and maintain them through periodic Hello messages with configurable hold times.
When a host joins a multicast group through IGMP (IPv4) or MLD (IPv6), the local designated router (DR) receives the membership report. The DR becomes responsible for forwarding traffic for that group and initiates PIM Join messages toward the RP. These Join messages travel hop-by-hop toward the RP, creating state in each intermediate router that establishes the shared tree.
When a sender transmits to a multicast group, the local DR encapsulates the first packets in PIM Register messages and unicasts them to the RP. The RP decapsulates these packets and forwards them down the shared tree to all registered receivers. Simultaneously, the RP may trigger Join messages toward the source to establish a shortest-path tree for more efficient delivery.
As traffic flows and receivers join, the network builds state that efficiently routes multicast traffic from sources to receivers. Periodically, traffic patterns may warrant switching from the shared tree to source-specific trees, a process controlled by the SPT-bit threshold configuration.
Rendezvous Point Concepts
Section titled “Rendezvous Point Concepts”The Rendezvous Point serves as the root of the shared tree for each multicast group. All multicast sources initially register with the RP, and all multicast receivers join through paths that converge at the RP. This centralized anchoring provides a predictable rendezvous point for sources and receivers to establish connectivity.
RP selection is a critical design decision in PIM-SM networks. The RP must be reachable from all routers in the multicast domain through the unicast routing infrastructure. Network administrators can statically configure RP addresses on all routers, or they can use the Bootstrap Router mechanism for dynamic RP election.
Static RP configuration offers simplicity and predictability. The administrator specifies one or more RP addresses, and all routers use these addresses directly. Static RP requires manual coordination when RP addresses change, making it more suitable for smaller, stable networks.
The Bootstrap Router mechanism provides dynamic RP election among candidate RPs. Routers configured as Candidate RP (C-RP) advertise their willingness to serve as RP, while routers configured as Candidate BSR (C-BSR) participate in BSR election. The elected BSR collects RP advertisements and distributes RP-set information to all PIM-SM routers in the domain.
RP failover is handled gracefully through the RP-set mechanism. When the current RP becomes unreachable, routers automatically switch to the next available RP from the RP-set without requiring manual reconfiguration. This resilience is essential for production networks requiring high availability.
Designated Router and Forwarder Roles
Section titled “Designated Router and Forwarder Roles”PIM-SM designates specific routers to perform critical functions on each network segment. The Designated Router (DR) serves as the primary PIM router on a multi-access network segment, responsible for sending Join/Prune messages toward the RP and processing Register messages from local sources.
DR election occurs through Hello message priority values. Routers exchange priority values, and the router with the highest priority becomes the DR. In case of priority ties, the router with the highest IP address wins. The DR role provides a single point of responsibility, preventing duplicate multicast traffic from multiple routers on the same segment.
On networks with local multicast sources, the DR additionally serves as the Designated Forwarder (DF) for those sources. The DF is responsible for forwarding traffic from local sources onto the multi-access network. This prevents multiple routers from forwarding identical multicast packets, which would cause duplication and inefficiency.
Protocol Overview
Section titled “Protocol Overview”PIM-SM uses several message types to establish and maintain multicast connectivity. Understanding these messages and their roles is essential for troubleshooting and optimizing PIM-SM deployments.
Hello Messages
Section titled “Hello Messages”Hello messages serve multiple purposes in PIM-SM: neighbor discovery, adjacency maintenance, and capability negotiation. Routers transmit Hello messages periodically on all PIM-enabled interfaces at the configured Hello interval, typically 30 seconds by default.
Hello messages contain important parameters including the Hello hold time (advertising how long the sender expects Hellos to continue), DR priority (used for Designated Router election), LAN prune delay (indicating the interface’s capability to delay Join suppression), and T-bit (indicating the router’s capability to track joins for multiple sources).
When a router receives a Hello from a new neighbor, it adds the neighbor to its neighbor table and begins maintaining the adjacency. If Hellos stop arriving within the hold time, the neighbor is considered down, and all PIM state associated with that neighbor is removed.
Join/Prune Messages
Section titled “Join/Prune Messages”Join and Prune messages are the primary mechanisms for group membership signaling in PIM-SM. Join messages request that upstream routers add the sending router to the distribution tree for specified multicast groups. Prune messages request removal from distribution trees when receivers leave groups.
Join/Prune messages travel upstream toward the RP for (*,G) joins, or toward the source for (S,G) joins. Each message specifies one or more multicast groups and the interfaces through which traffic should be forwarded or withheld.
On multi-access networks, Join suppression occurs when multiple routers have downstream members for the same group. Only the router with the highest DR priority sends Join messages upstream, and other routers suppress their Joins knowing the designated router will maintain the shared tree.
Bootstrap and Candidate-RP Messages
Section titled “Bootstrap and Candidate-RP Messages”The Bootstrap Router mechanism provides dynamic RP election in PIM-SM domains. Candidate BSR routers participate in BSR election through Bootstrap messages, with the highest priority BSR eventually elected to collect and distribute RP information.
Candidate RP routers advertise their willingness to serve as RP to the elected BSR through Candidate-RP Advertisement messages. These advertisements include the RP address, the multicast groups for which the router can serve as RP, and the RP priority.
The BSR compiles RP information from all Candidate RPs into an RP-set and distributes this set to all PIM-SM routers in the domain through Bootstrap messages. All routers then use consistent RP selection rules to determine the best RP for each multicast group.
Register Messages
Section titled “Register Messages”Register messages transport multicast traffic from sources to the RP when sources and receivers are separated by PIM-SM routers. The local DR encapsulates the first multicast packet in a Register message and unicasts it to the RP.
Upon receiving a Register message, the RP decapsulates the packet and forwards it down the shared tree to all interested receivers. The RP also sends a Join message toward the source to establish a source-specific tree for more efficient delivery.
When the RP receives sufficient traffic via the source-specific tree, it sends a Register-Stop message to the source DR, instructing it to stop encapsulating packets. Subsequent traffic flows natively through the source-specific tree without encapsulation overhead.
Configuration
Section titled “Configuration”PIM-SM configuration in RouterOS involves creating instances, defining interfaces, and optionally configuring RP selection mechanisms. This section covers basic and advanced configuration scenarios.
Basic Single-Router Configuration
Section titled “Basic Single-Router Configuration”For simple multicast scenarios where a single router connects multicast sources and receivers, basic PIM-SM configuration requires minimal steps. This configuration enables the router to respond to IGMP reports and route multicast traffic between connected networks.
Begin by ensuring IP addresses are configured on router interfaces:
/ip addressadd address=192.168.10.1/24 interface=ether1 network=192.168.10.0add address=192.168.20.1/24 interface=ether2 network=192.168.20.0Configure a PIM-SM instance using default settings:
/routing pimsm instanceadd name=pimsm-instance-1Add interfaces to the PIM-SM instance using interface templates:
/routing pimsm interface-templateadd interfaces=ether1,ether2 instance=pimsm-instance-1The router now listens for IGMP membership reports on configured interfaces and routes multicast traffic between networks with interested receivers. Use the following commands to verify the configuration:
# View active multicast groups/routing pimsm uib-g print
# View multicast sources and group state/routing pimsm uib-sg printStatic RP Configuration
Section titled “Static RP Configuration”For networks requiring manual RP control, static RP configuration provides predictable RP selection without Bootstrap Router complexity. All routers in the PIM-SM domain must be configured with the same static RP information.
Configure the RP address on the designated RP router:
/routing pimsm static-rpadd address=10.0.0.1 instance=pimsm-instance-1On all other routers in the domain, configure the same RP address:
/routing pimsm static-rpadd address=10.0.0.1 instance=pimsm-instance-1Multiple static RPs can be configured for the same multicast group range, providing failover capability:
/routing pimsm static-rpadd address=10.0.0.1 instance=pimsm-instance-1add address=10.0.0.2 instance=pimsm-instance-1The RP with the lowest IP address is preferred when multiple RPs serve the same group range. This ordering can be modified by adding RPs with explicit priority values:
/routing pimsm static-rpadd address=10.0.0.1 instance=pimsm-instance-1 priority=200add address=10.0.0.2 instance=pimsm-instance-1 priority=100Bootstrap Router Configuration
Section titled “Bootstrap Router Configuration”For larger networks where static RP management becomes burdensome, the Bootstrap Router mechanism provides dynamic RP election. Configure Candidate RP and Candidate BSR routers as needed.
Configure a router as Candidate RP:
/routing pimsm instanceset pimsm-instance-1 c-rp=yesConfigure the Candidate RP interface and priority:
/routing pimsm instanceset pimsm-instance-1 c-rp-interface=loopback c-rp-priority=192Configure Candidate BSR routers to participate in BSR election:
/routing pimsm instanceset pimsm-instance-1 c-bsr=yes/routing pimsm instanceset pimsm-instance-1 c-bsr-interface=loopback c-bsr-priority=64Verify BSR and RP election results:
# View elected BSR/routing pimsm bsr print
# View active RPs/routing pimsm rp printInterface Template Configuration
Section titled “Interface Template Configuration”Interface templates define how PIM-SM operates on router interfaces. Multiple templates can apply different configurations to different interface sets.
Basic interface template configuration:
/routing pimsm interface-templateadd instance=pimsm-instance-1 interfaces=ether1,ether2 priority=1ConfigureHello and override intervals on specific interfaces:
/routing pimsm interface-templateadd instance=pimsm-instance-1 interfaces=ether1 hello-interval=30s hello-holdtime=105sDisable PIM-SM on specific interfaces within a template range by excluding them:
/routing pimsm interface-templateadd instance=pimsm-instance-1 interfaces=ether1,ether2,ether3 exclude-interfaces=ether3Advanced Configuration
Section titled “Advanced Configuration”Source-Specific Multicast
Section titled “Source-Specific Multicast”Source-Specific Multicast (SSM) provides simplified multicast where receivers specify both group and source. This eliminates RP dependency for SSM groups and provides sender-specific security.
Configure SSM address range:
/routing pimsm instanceset pimsm-instance-1 ssm-range=232.0.0.0/8With SSM configured, receivers join specific (S,G) channels rather than (*,G) groups. The router does not require RP configuration for SSM groups.
BSR Boundary Configuration
Section titled “BSR Boundary Configuration”BSR boundaries restrict Bootstrap message propagation between network segments, limiting RP election scope for administrative purposes.
Configure BSR boundary on an interface:
/routing pimsm interface-templateadd interfaces=ether1 instance=pimsm-instance-1 bsr-boundary=yesBSR messages are not forwarded across boundary interfaces, isolating RP election within the bounded region.
Multicast Boundary Configuration
Section titled “Multicast Boundary Configuration”Multicast boundaries control which multicast traffic can cross interface boundaries, implementing access control and traffic engineering policies.
Configure multicast boundary on an interface:
/routing pimsm interface-templateadd interfaces=ether1 instance=pimsm-instance-1 multicast-boundary=239.0.0.0/8Traffic matching the boundary ACL is either permitted or denied based on policy configuration.
Parameters Reference
Section titled “Parameters Reference”Instance Configuration Parameters
Section titled “Instance Configuration Parameters”| Parameter | Default | Description |
|---|---|---|
name | (required) | Instance identifier |
disabled | no | Disable instance |
c-rp | no | Enable Candidate RP |
c-rp-interface | Interface for C-RP advertisements | |
c-rp-priority | 192 | C-RP priority (lower is preferred) |
c-rp-holdtime | 150s | C-RP advertisement hold time |
c-bsr | no | Enable Candidate BSR |
c-bsr-interface | Interface for C-BSR advertisements | |
c-bsr-priority | 0 | C-BSR priority (higher is preferred) |
bsr-address | Static BSR address override | |
ssm-range | SSM address range (e.g., 232.0.0.0/8) |
Interface Template Parameters
Section titled “Interface Template Parameters”| Parameter | Default | Description |
|---|---|---|
interfaces | (required) | Comma-separated interface list |
exclude-interfaces | Interfaces to exclude from template | |
instance | (required) | PIM-SM instance reference |
priority | 1 | DR election priority (higher is preferred) |
hello-interval | 30s | Hello message interval |
hello-holdtime | 105s | Hello hold time |
dr-priority | 1 | Designated Router priority |
bsr-boundary | no | Enable BSR boundary |
multicast-boundary | Multicast address boundary | |
disabled | no | Disable template |
Static RP Parameters
Section titled “Static RP Parameters”| Parameter | Default | Description |
|---|---|---|
address | (required) | RP IPv4 address |
instance | (required) | Instance reference |
group | 224.0.0.0/4 | Multicast group range |
priority | 192 | RP priority for this group |
disabled | no | Disable static RP entry |
Status Commands
Section titled “Status Commands”| Command | Description |
|---|---|
/routing pimsm neighbor print | View PIM neighbors |
/routing pimsm bsr print | View elected BSR |
/routing pimsm rp print | View active RPs |
/routing pimsm uib-g print | View (*,G) join state |
/routing pimsm uib-sg print | View (S,G) join state |
/routing pimsm interface-template print | View interface templates |
Troubleshooting
Section titled “Troubleshooting”Neighbors Not Forming
Section titled “Neighbors Not Forming”When PIM-SM neighbors fail to establish, verify basic connectivity and configuration alignment.
Verify interface configuration - Ensure PIM-SM is enabled on both endpoints:
/routing pimsm interface-template/printCheck connectivity - Verify IP reachability between routers:
ping 10.0.0.2Verify PIM-SM is running - Check that the instance is enabled and interfaces are active:
/routing pimsm instance/printCheck firewall rules - Ensure PIM protocol (103) and IGMP (2) traffic is permitted:
/ip/firewall/filter/print chain=forward protocol=pimMulticast Traffic Not Flowing
Section titled “Multicast Traffic Not Flowing”When multicast traffic fails to reach receivers, trace the distribution tree state.
Verify IGMP membership - Check that receivers have joined groups:
/routing gmp/printCheck join state - Verify (*,G) and (S,G) state exists:
/routing pimsm uib-g print/routing pimsm uib-sg printTrace toward RP - Follow Join messages upstream to identify missing state:
/routing pimsm neighbor printVerify RP reachability - Ensure all routers can reach the RP:
ping 10.0.0.1Check interface traffic - Use torch to observe multicast packets:
/tool torch interface=ether1 protocol=udp dst-port=anyRP Election Issues
Section titled “RP Election Issues”When Bootstrap Router or RP election fails, verify candidate configuration and message propagation.
Verify Candidate RP configuration - Check that C-RP is properly configured:
/routing pimsm instance/print where c-rp=yesCheck BSR election - Verify C-BSR participation:
/routing pimsm instance/print where c-bsr=yesView RP cache - Examine learned RP information:
/routing pimsm rp printDebug BSR messages - Enable PIM-SM debugging:
/system logging add topics=routing,pimsm,debugVerification Commands
Section titled “Verification Commands”# View all PIM-SM neighbors and status/routing pimsm neighbor print detail
# Monitor neighbor changes in real-time/routing pimsm neighbor/monitor
# View interface template status/routing pimsm interface-template/print detail
# Check RP-set information/routing pimsm rp print detail
# View multicast routing table/routing multicast print
# Monitor active multicast groups/routing pimsm uib-g print/routing pimsm uib-sg printPerformance Considerations
Section titled “Performance Considerations”Timer Optimization
Section titled “Timer Optimization”PIM-SM timer values affect convergence speed and protocol overhead. Hello intervals and hold times should balance responsiveness against protocol traffic. For most deployments, default values provide adequate performance.
Dense networks with many PIM neighbors may benefit from longer Hello intervals to reduce protocol traffic. Increase Hello interval to 60s or 90s on stable networks:
/routing pimsm interface-templateset [find] hello-interval=60s hello-holdtime=180sTime-sensitive applications may require faster failure detection. Decrease Hello interval to 10s on critical links:
/routing pimsm interface-templateset [find] hello-interval=10s hello-holdtime=30sScaling Considerations
Section titled “Scaling Considerations”PIM-SM maintains state for each multicast group with active receivers. Large-scale multicast deployments require appropriate resources.
Each active multicast group requires memory for (*,G) state on routers along the shared tree. Additional (S,G) state is created for sources on shortest-path trees. Monitor memory usage when deploying thousands of concurrent multicast groups:
/system/resource/printOn routers with limited memory, consider SSM deployment which eliminates (*,G) state and only maintains (S,G) state for actively used source-receiver pairs.
Interface Count Impact
Section titled “Interface Count Impact”Interface templates with many interfaces increase PIM-SM processing requirements. Consider splitting templates by interface function:
# High-priority interfaces (trunk links)add interfaces=ether1,ether2 instance=pimsm-instance-1 priority=10
# Standard interfaces (access links)add interfaces=ether3-ether10 instance=pimsm-instance-1 priority=1Security Considerations
Section titled “Security Considerations”RP Security
Section titled “RP Security”RP routers represent central points of failure and attack in PIM-SM networks. Protect RP routers through physical and logical security measures.
Deploy RPs on secure network segments with restricted access. Use access lists to permit only authorized PIM traffic:
/ip/firewall/filter/add chain=forward protocol=pim action=accept/ip/firewall/filter/add chain=forward protocol=pim action=dropConsider deploying multiple RPs to provide redundancy and load distribution across secure infrastructure.
Message Authentication
Section titled “Message Authentication”PIM-SM lacks native message authentication in RouterOS. Networks requiring message integrity should deploy authentication at lower layers.
Use IPsec AH or ESP to authenticate all PIM traffic between routers:
/ip/ipsec/policy add src-address=10.0.0.0/24 dst-address=10.0.1.0/24 \ sa-src-address=10.0.0.1 sa-dst-address=10.0.1.1 \ proposal=default authentication=-sha1Deploy within controlled network boundaries where unauthorized PIM routers cannot inject false messages.
IGMP/MLD Security
Section titled “IGMP/MLD Security”Local receiver management through IGMP and MLD should be protected against spoofing.
Deploy IGMP snooping switches to filter unauthorized IGMP reports on access ports:
/interface/bridge/settings set use-ip-firewall=no/interface/bridge/port set [find] pvid=1Use IGMP querier configuration to ensure only authorized routers send queries:
/routing gmp set query-interval=125sBest Practices
Section titled “Best Practices”-
Deploy redundant RPs with appropriate priority separation to ensure rapid failover during RP failures.
-
Use static RP for small, stable networks to eliminate BSR complexity. Use BSR for larger networks requiring dynamic RP management.
-
Configure consistent hello and hold times across all PIM-SM routers to ensure predictable neighbor failure detection.
-
Monitor multicast group membership patterns to appropriately size RP resources and network capacity.
-
Deploy PIM-SM only on devices with adequate CPU and memory for expected multicast scale.
-
Use SSM for applications where receivers specify both group and source, eliminating RP dependency and improving security.
-
Document RP addresses, BSR candidates, and multicast group policies for operational reference.
-
Test multicast functionality regularly using traffic generators and receivers to verify operational readiness.
-
Consider multicast boundaries to limit scope of multicast traffic and implement access control.
-
Deploy IGMP snooping switches on access networks to optimize local multicast traffic distribution.
Related Topics
Section titled “Related Topics”- IGMP - Internet Group Management Protocol for IPv4 multicast receiver management
- MLD - Multicast Listener Discovery for IPv6 multicast receiver management
- GMP - Group Management Protocol for multicast group configuration
- OSPF - Unicast routing often used with PIM-SM
- BGP - BGP multicast address family for inter-domain multicast
- Multicast Routing - General multicast routing concepts and RouterOS implementation