Protocol Independent Multicast - Sparse Mode (PIM-SM) HowTo

About

This document aims to provide some example use cases and example scenarios how Protocol Independent Multicast - Sparse Mode (PIM-SM) could be utilized to simplify multicast routing.

Introduction

Multicast routing can be tricky and difficult to configure and scale, when using only static multicast routing. PIM simplifies the configuration of multicast routing in a network by allowing it to be configured in a dynamic manner.

PIM relies on the underlying unicast routing in order to operate. So it is still necessary to ensure that the network have a solid unicast routing setup. However, this is in many cases easier to configure and understand for most users. How the unicast routing is set up is not important, as long as it is correct. As the name suggests, PIM functions independently in regards to the underlying unicast protocol. Therefore, it functions really well together with a dynamic unicast routing protocol like OSPF or RIP.

PIM is a family consisting of a few different variants. This document focus solely on the set up and usage of the Sparse Mode (SM) variant. PIM-SM is best used for setups where the potential receivers of multicast are sparsely scattered throughout the intended network topology. In this scenario it also scales pretty well in somewhat larger topologies as well.

The examples in this document are somewhat simplified in order to try and convey the basics and to provide an understanding of how PIM is configured using the system.

Case 1: PIM-SM With Any Source Multicast

This example covers how PIM-SM with the so called Any Source Multicast (ASM) mode can be configured. In the ASM mode the source of any given multicast stream does not need to be known by any of the potential receivers in the network. The receivers only need to know what multicast that they may want to receive.

The central aspect when using the ASM mode is the Rendezvous Point (RP). Since the receivers may be unaware of where the source of any requested multicast is located, the RP serves as a sort of meeting point for receivers and senders. For a more detailed explanation of this refer to the PIM-SM Configuration Guide.

              .----. (Receiver)              .----. (Receiver)
              | H1 |                         | H2 |
              '-+--'                         '--+-'
             .99|                               |.99
                |                               |
192.168.10.0/24 |                               | 192.168.20.0/24
                |                               |
              .1| vlan3                   vlan3 |.2
      (LHR) .---+----.                     .----+---. (LHR)
       (DR) |        |.1   10.0.1.0/24   .2|        | (DR)
            |   R1   +---------------------+   R2   |
            |        | vlan1         vlan2 |        |
            '---+----'                     '----+---'
              .1| vlan2                   vlan1 |.2
                |                               |
    10.0.4.0/24 |                               | 10.0.2.0/24
                |                               |
              .3| vlan1                   vlan2 |.4
      (FHR) .---+----.                     .----+---. (RP)
            |        | vlan2         vlan1 |        |
            |   R3   +---------------------+   R4   |
            |        |.3   10.0.3.0/24   .4|        |
            '---+----'                     '--------'
              .3| vlan3
                |
192.168.30.0/24 |
                |
             .99|
              .-+--. (Sender)
              | S1 |
              '----'

Figure 1: An example of a PIM-SM ASM setup in simple network topology.

In the example topology presented in Figure 1 four routers are used to form the PIM domain. All these routers need to first be configured with a unicast routing protocol.

When the unicast routing have been set up, the main focus will be the configuration of PIM on all of the routers. The main configuration aspect is to ensure that the router R4 will be the configured as the RP, located at the address 10.0.2.4.

When everything has been configured the receivers H1 and H2 should be able to receive any multicast stream produced by the sender S1.

Configuration

There are a few different things that needs to be configured before we will be able to route multicast from the sender to the receivers:

  • Configuration of the underlying unicast routing.
  • Ensuring that multicast forwarding is enabled on all of the routers.
  • Making sure that IGMP is enabled on the relevant interfaces, the ones facing the receivers.
  • Configuration of PIM-SM specific settings.
    • Selection of PIM interfaces.
    • Location of the RP.

For this example it is assumed that the interfaces and their IP addresses have already been configured.

Underlying Unicast Routing

In this example we will use OSPF as our underlying routing protocol. It needs to be configured on each of the individual routers. All of the internal networks 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24 and 10.0.4.0/24 will be added as OSPF networks. The connections to the sender and the receivers will be configured to be redistributed into the OSPF network with redistribute connected.

Configuration of router R1:

R1:/#> configure
R1:/config/#> router
R1:/config/router/#> ospf
R1:/config/router/ospf/#> network 10.0.1.0/24
R1:/config/router/ospf/#> network 10.0.4.0/24
R1:/config/router/ospf/#> redistribute connected
R1:/config/router/ospf/#> leave
R1:/#>

Configuration of router R2:

R2:/#> configure
R2:/config/#> router
R2:/config/router/#> ospf
R2:/config/router/ospf/#> network 10.0.1.0/24
R2:/config/router/ospf/#> network 10.0.2.0/24
R2:/config/router/ospf/#> redistribute connected
R2:/config/router/ospf/#> leave
R2:/#>

Configuration of router R3:

R3:/#> configure
R3:/config/#> router
R3:/config/router/#> ospf
R3:/config/router/ospf/#> network 10.0.3.0/24
R3:/config/router/ospf/#> network 10.0.4.0/24
R3:/config/router/ospf/#> redistribute connected
R3:/config/router/ospf/#> leave
R3:/#>

Configuration of router R4:

R4:/#> configure
R4:/config/#> router
R4:/config/router/#> ospf
R4:/config/router/ospf/#> network 10.0.2.0/24
R4:/config/router/ospf/#> network 10.0.3.0/24
R4:/config/router/ospf/#> leave
R4:/#>

This configuration should be enough to ensure that the underlying unicast routing, required for PIM to function, is in place.

IGMP

For PIM to function IGMP must be enabled on the interfaces that face any potential receiver. Therefore, ensure that IGMP is enabled on the receiver interfaces on router R1 and R2.

R1:/#> configure
R1:/config/#> vlan 3
R1:/config/vlan-3/#> multicast-snooping
R1:/config/vlan-3/#> leave
R1:/#>
R2:/#> configure
R2:/config/#> vlan 3
R2:/config/vlan-3/#> multicast-snooping
R2:/config/vlan-3/#> leave
R2:/#>

Multicast Forwarding

Multicast forwarding is not enabled by default on the system. In order for PIM to be configurable on the system it must be enabled on every router that is to operate as a multicast router. We can enable it under the ip configuration context using the multicast-forwarding.

R1:/#> configure
R1:/config/#> ip
R1:/config/ip/#> multicast-forwarding
R1:/config/ip/#> leave
R1:/#>
R2:/#> configure
R2:/config/#> ip
R2:/config/ip/#> multicast-forwarding
R2:/config/ip/#> leave
R2:/#>
R3:/#> configure
R3:/config/#> ip
R3:/config/ip/#> multicast-forwarding
R3:/config/ip/#> leave
R3:/#>
R4:/#> configure
R4:/config/#> ip
R4:/config/ip/#> multicast-forwarding
R4:/config/ip/#> leave
R4:/#>

PIM-SM

At this point PIM-SM itself is the last thing to be configured. The minimum required is to specify the location of the RP at 10.0.2.4 router R3. This must be configured exactly the same on each of the PIM routers in the network.

Lastly the interfaces that PIM is to operate on also must be provided in the configuration. Any interface facing another PIM router, a multicast source or a multicast receiver must be specified.

Configuration of router R1:

R1:/#> configure
R1:/config/#> router
R1:/config/router/#> pim
R1:/config/router/pim/#> interface vlan1 vlan2 vlan3
R1:/config/router/pim/#> rendezvous-point 10.0.2.4
R1:/config/router/pim/#> leave
R1:/#>

Configuration of router R2:

R2:/#> configure
R2:/config/#> router
R2:/config/router/#> pim
R2:/config/router/pim/#> interface vlan1 vlan2 vlan3
R2:/config/router/pim/#> rendezvous-point 10.0.2.4
R2:/config/router/pim/#> leave
R2:/#>

Configuration of router R3:

R3:/#> configure
R3:/config/#> router
R3:/config/router/#> pim
R3:/config/router/pim/#> interface vlan1 vlan2 vlan3
R3:/config/router/pim/#> rendezvous-point 10.0.2.4
R3:/config/router/pim/#> leave
R3:/#>

Configuration of router R4:

R4:/#> configure
R4:/config/#> router
R4:/config/router/#> pim
R4:/config/router/pim/#> interface vlan1 vlan2
R4:/config/router/pim/#> rendezvous-point 10.0.2.4
R4:/config/router/pim/#> leave
R4:/#>

If everything has been configured correctly, it should now be possible to route a multicast stream thorough the network from S1 to any of the receivers H1 or H2.

Status

Before any multicast groups are requested by any of the receivers, or any streams transmitted by any source, we could take a quick look if everything initially seems to be correctly configured and running. The show ip pim command can be used to display a collection of a number of different pim status outputs, for more status see the following.

Initial PIM Status on router R1 should look something like this:

R1:/#> show ip pim

PIM Rendezvous Point Info                                                     
RP-ADDRESS  GROUP/PREFIX-LIST  OIF      I-AM-RP  SOURCE  GROUP-TYPE           
10.0.2.4    224.0.0.0/4        Unknown  no       Static  ASM

PIM Interfaces                                                                
INTERFACE  STATE  ADDRESS       PIM-NBRS  PIM-DR    FHR  IF-CHANNELS          
pimreg     up     0.0.0.0       0         local     0    0
vlan1      up     10.0.1.1      1         10.0.1.2  0    0
vlan2      up     10.0.4.1      1         10.0.4.3  0    0
vlan3      up     192.168.10.1  0         local     0    0

PIM Neighbors                                                                 
INTERFACE  NEIGHBOR  UPTIME    HOLDTIME  DR-PRIO                              
vlan1      10.0.1.2  00:00:03  00:01:42  1
vlan2      10.0.4.3  00:00:02  00:01:43  1

PIM Join                                                                      
INTERFACE  ADDRESS  SOURCE  GROUP  STATE  UPTIME  EXPIRE  PRUNE               

PIM Upstream                                                                  
IIF  SOURCE  GROUP  STATE  UPTIME  JOINTIMER  RSTIMER  KATIMER  REFCNT        
R1:/#>

For each of the PIM routers we should be able to see that the Interfaces are configured correctly. It is also good to see that the neighbors are detected correctly. Verifying that the RP is configured and reported correctly on each of the routers is also good, since if this is incorrect PIM may not function.

If everything looks okay so far we could now verify that we can route a multicast stream from the sender to any of the receivers.

Tip

For testing purposes the OS has access to the too mcjoin that can be used to both join a specific multicast group and transmit a stream towards that group.

As an example we use it to join group 225.1.2.3 acting as device H1:

H1:/#> shell
Domain shell started.
root@H1:/home/admin # mcjoin -i vlan1 -j 225.1.2.3

Next, this is how we could create a stream using the same tool on S1:

S1:/#> shell
Domain shell started.
root@S1:/home/admin # mcjoin -i vlan1 -s -t 5 225.1.2.3

If we have requested traffic for group 225.1.2.3 on H1 and we are transmitting it from S1 we should be able to check the installed multicast routes, and it should look something like this for each of the routers:

R1:/#> show ip pim mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
SOURCE         GROUP      FLAGS  PROTO  INPUT  OUTPUT  TTL  UPTIME    
*              225.1.2.3  SC     IGMP   vlan1  pimreg  1    00:05:50
                                 IGMP          vlan3   1
192.168.30.99  225.1.2.3  ST     STAR   vlan2  vlan3   1    00:05:35
R2:/#> show ip pim mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
SOURCE         GROUP      FLAGS  PROTO  INPUT  OUTPUT  TTL  UPTIME    
*              225.1.2.3  S      PIM    vlan1  vlan2   1    00:07:34
192.168.30.99  225.1.2.3  SRP    none   vlan1  none    0    --:--:--
R3:/#> show ip pim mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
SOURCE         GROUP      FLAGS  PROTO  INPUT  OUTPUT  TTL  UPTIME    
192.168.30.99  225.1.2.3  SFT    PIM    vlan3  vlan1   1    00:07:26
R4:/#> show ip pim mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
SOURCE         GROUP      FLAGS  PROTO  INPUT  OUTPUT  TTL  UPTIME    
*              225.1.2.3  S      none   vlan2  none    0    --:--:--
192.168.30.99  225.1.2.3  SRP    none   vlan1  none    0    --:--:--

By checking the routes we should see that the flow of traffic should be S1 –> R3 –> R1 –> H1, by using the (192.168.30.99,225.1.2.3) mroutes.