Showing posts with label Multicast. Show all posts
Showing posts with label Multicast. Show all posts

Thursday, February 6, 2014

NTS: Advanced Multicast

Advanced Multicast




RPF (Reverse Path Forwarding)

In an RPF check, the router looks in a routing table to determine its RPF interface, which is the interface closest to the root (the source or the RP). The RPF interface is also the incoming interface for the multicast data. RPF checks happen in the control-plane (PIM, MSDP) and in the data-plane (multicast data).

The routing table used for RPF checks can be the global unicast routing table or a separate multicast routing table. In any case, the RPF table contains only unicast routes (the multicast source or the RP).

MP-BGP and M-ISIS can be used to create separate unicast and multicast routing tables.

MP-BGP updates can include IPv4 multicast RPF routes along with IPv4 unicast routes, totally separated (different path attributes) from each other.

You can use "sh ip mroute count" to check for increasing RPF counts.


Fixing RPF issues

If you have IP connectivity over a TE tunnel and require PIM connectivity too, then extra care must be taked. Since you cannot activate PIM on a TE tunnel, you must somehow fix the possible RPF issue on the head-end. The same must be done in every other case where unicast and multicast forwarding do not agree.

Solutions
  • static mroute
  • multicast BGP
  • multicast topology in IS-IS
  • mpls traffic-eng multicast-intact (for IGP routes)

You can use the command "sh ip rpf" in order to verify RPF issues.

Before

IOS
R2#sh ip rpf 19.19.19.19
 failed, no route exists



IOS-XR
GSR#sh pim rpf 2.2.2.2
Table: IPv4-Unicast-default
* 2.2.2.2/32 [115/30]
    via Null with rpf neighbor 0.0.0.0



In IOS-XR, the command "sh pim rpf" provides an output only if the address provided is already used as a multicast source. Use "sh pim rpf hash" to check in advance.

After fixing the RPF issue:

IOS
R2#sh ip rpf 19.19.19.19
RPF information for ? (19.19.19.19)
  RPF interface: FastEthernet1/0.24
  RPF neighbor: ? (26.2.4.4)
  RPF route/mask: 19.19.19.19/32
  RPF type: unicast (isis)
  Doing distance-preferred lookups across tables
  RPF topology: ipv4 multicast base, originated from ipv4 unicast base


IOS-XR
GSR#sh pim rpf 2.2.2.2
Table: IPv4-Multicast-default
* 2.2.2.2/32 [115/30]
    via GigabitEthernet0/1/0/1 with rpf neighbor 26.3.19.3



static mroute

IOS
ip mroute 2.2.2.2 255.255.255.255 Tunnel0

IOS-XR
multicast-routing
 address-family ipv4
  static-rpf 2.2.2.2 32 tunnel-te0 3.3.3.3



multicast-intact

When enabled on an IGP, the IGP automatically publishes to the RIB a parallel (or alternate) set of equal-cost next-hops for all IPv4 destinations learned through LS advertisements, for use solely by PIM. These next-hops are called mcast-intact next-hops. The mcast-intact next-hops have the following characteristics:

  • They are guaranteed not to contain any IGP shortcuts (like TE tunnels).
  • They are not used for unicast routing, but are used only by PIM to look up an IPv4 next-hop to a PIM source.
  • They are not published to the FIB.
  • When multicast-intact is enabled on an IGP, all IPv4 destinations that were learned through link-state advertisements are published with a set of equal-cost mcast-intact next-hops to the RIB. This attribute applies even when the native next-hops have no IGP shortcuts.

IOS
router ospf 1
 mpls traffic-eng multicast-intact
router isis 1
 mpls traffic-eng multicast-intact

IOS-XR
router ospf 1
 mpls traffic-eng multicast-intact
!

router isis 1
 address-family ipv4 unicast
  mpls traffic-eng multicast-intact



Multicast-intact doesn't work with TE forwarding-adjacency, use multicast BGP or static mroute.

multicast-intact vs static mroute in TE tunnels
  • use multicast-intact to accept multicast traffic coming from outside a TE tunnel, when the unicast route is pointing inside the TE tunnel
  • use static mroute to accept multicast traffic coming from inside a TE tunnel, when the unicast route is pointing outside the TE tunnel

IS-IS Multicast Topology

Multicast topology for ISIS allows the configuration of a separate IS-IS multicast topology for IPv4 or IPv6 routing, which runs a separate SPF.

IS-IS multicast inserts routes from the IS-IS multicast topology into the multicast-unicast table in the RIB for the corresponding address family. Since PIM uses this table, PIM uses routes from the multicast topology instead of routes from the unicast topology.


Multicast BGP

The multicast BGP database can be used by a a multicast routing protocol (i.e. PIM) to perform RPF lookups for multicast-capable sources. Thus, packets can be sent and accepted based on the multicast topology and not on the unicast topology.

This is an easy way to change the multicast routing without affecting unicast too. Static mroutes can also be used.

IOS
router bgp 65000
 no bgp default ipv4-unicast
 neighbor 7.7.7.7 remote-as 65000
 !
 address-family ipv4 multicast
  neighbor 7.7.7.7 activate

  network 192.168.7.0
 exit-address-family


IOS-XR
router bgp 65000
 address-family ipv4 multicast
  network 192.168.7.0/24
 !
 neighbor 7.7.7.7
  address-family ipv4 multicast



IOS
R8#sh ip rpf 192.168.7.0
RPF information for ? (192.168.7.0)
  RPF interface: FastEthernet0/0
  RPF neighbor: ? (192.168.78.7)
  RPF route/mask: 192.168.7.0/24
  RPF type: mbgp
  RPF recursion count: 0
  Doing distance-preferred lookups across tables



Changing of BGP distance might be needed on the remote peer, if an IGP already provides a better route.

When you enable the multicast address-family under BGP, then these prefixes take precedence over the prefixes learned in the BGP unicast address-family; only the BGP prefixes learned in the multicast address-family are used for any multicast routing. Use "show route ipv4 multicast" in IOS-XR to display the ipv4 multicast routes.

You might need to also advertise a specific next-hop for the RPF route, if the default next-hop doesn't satisfy the RPF needs (recursive lookup might not be supported).



MSDP & Anycast RP

MSDP provides a way to connect multiple PIM-SM domains, so that RPs can exchange information about active multicast sources. It uses

MSDP sessions are formed between the RPs of various PIM domains, which are called MSDP peers.

MSDP is also used between Anycast RPs within a single PIM domain to synchronize information about the active sources being served by each Anycast-RP peer. Anycast RPs will each have the same IP address configured on a Loopback interface (making this the Anycast address) and will MSDP peer with each other using a separate loopback interface.

With Anycast RP, RP failover depends only on IGP convergence

MSDP RPs send SA (Source-Active) messages in order to notify each other of active multicast sources.

An MSDP RP sends an SA message to its peers each time it receives a PIM Register or Null-Register message from a Source DR about a new/active source. MSDP SA messages include the same multicast data that is also encapsulated in PIM Register or Null-Register messages.


IOS
interface Loopback99
 ip address 99.99.99.99 255.255.255.255
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
ip msdp peer 1.1.1.1 connect-source Loopback0
ip msdp originator-id Loopback0

!
ip pim rp-address 99.99.99.99



IOS-XR
interface Loopback99
  ipv4 address 99.99.99.99 255.255.255.255
!

interface Loopback0
  ipv4 address 1.1.1.1 255.255.255.255
!
router msdp
 originator-id Loopback0
 peer 2.2.2.2
  connect-source Loopback0
!
router pim
 address-family ipv4
  rp-address 99.99.99.99



The address on the interface used as anycast RP must be advertised into an IGP (preferably as external route to be able to play easily with the metric).

When using anycast IPv4 addresses in Loopbacks, it's good practice to hardcode all the protocol router-ids manually in order to avoid using the anycast address as router-id for a protocol.

In some software releases originator-id might not be required, but it's always good practice to configure it (especially in anycast topologies).

In current releases, when running Inter-AS MSDP, the peer/source IPs must agree with the BGP update source on each neighbor. If you also have a BGP peering session with an MSDP peer, you should use the same IP address for MSDP (peer/connect-source) as you do for BGP (update-source). If MDT is using a non-loopback interface due to eBGP with directly connected neighbor, you might get the message "%MDT-4-LBSRC: VRF ABC: MDT X uses source address x.x.x.x from a non-loopback interface". Besides changing the update-source of the eBGP peering, you can also use the "bgp next-hop loopback X" command under the appropriate vrf.

Use "default-peer" in IOS-XR when the peer address isn't in BGP.

If there is a single MSDP peer, then no RPF check takes place about the originator-id. If there are multiple MSDP peers, then you can put them under a mesh-group in order to disable the RPF check on them.


Links




Multicast Filtering

Setting an interface to PIM v1 at the border of a PIM domain prevents v2 Bootstrap messages from leaking to the neighboring PIM domain.

Use "ip pim passive" under an interface if you want to block the forwarding of PIM control plane traffic; only IGMP traffic will pass.

BSR filtering

IOS
interface X
 ip pim bsr-border



IOS-XR
router pim
 address-family ipv4
  interface X
   bsr-border




Auto-RP filtering

IOS-XR
multicast-routing
 address-family ipv4
  interface TenGigE0/2/0/0
   boundary MCAST-ACL

!
ipv4 access-list MCAST-ACL
 deny host 224.0.1.39
 deny host 224.0.1.40
 permit any



IGMP filtering

IOS
interface X
 ip igmp access-group IGMP-ACL


! match (*,G)
ip access-list extended IGMP-ACL
 permit ip host 0.0.0.0 host GROUP


! match (S,G) and (*,G)
ip access-list extended IGMP-ACL
 permit ip any host GROUP





Multicast Admission Control


  • Global or per VRF
    • limit the number of mroutes that can be added to the global table
      • ip multicast route-limit MAX-MROUTES THRESHOLD
    •  limit the number of mroutes that can be added to a particular MVRF table
      • ip multicast vrf MVRF route-limit MAX-MROUTES THRESHOLD
    • limit the number of mroute states created from IGMP membership reports
      • ip igmp limit MAX-IGMPS
  • Per interface
    • limit the number of mroute states
      • ip multicast limit MCAST-ACL MAX-MROUTES
    • limit the number of mroutes states created from  IGMP membership reports
      • ip igmp limit MAX-IGMPS
  • Per neighbor
    • Limits the number of SA messages allowed in the SA cache from an MSDP peer
      • ip msdp sa-limit MSDP-PEER MAX-SA-MESSAGES
         
Check "Multicast Filtering" above for the format of MCAST-ACL.


Rate-limit

The "ip multicast rate-limit" interface command is not supported any more.

You need to use the the MQC syntax to define multicast traffic and then police it accordingly.




Multicast Fast Convergence

  • tune PIM hellos (queries)
  • tune RPF check interval/backoff
  • MoFRR


Multicast-only FRR

The basic idea of MoFRR is to send a secondary PIM join from the receiver toward the source on a backup path to a different upstream interface. The network then receives two copies of the multicast stream over two separate and redundant paths through the network, but the redundant packets are discarded at topology merge points due to RPF checks. When the primary path fails, it can switch over to the backup path instantly without issuing a new PIM join. 

Actually MoFRR is pre-building an alternate multicast tree in order to achieve faster convergence.

  • RIB-based MoFRR
    • Supported on CRS and XR12000 series routers
    • Based on routing convergence
  • Flow-based MoFRR
    • Supported ASR9k
    • Based on packet count per 30ms


IOS (15.2)

ip multicast rpf mofrr MOFRR-SG-ACL
!
ip access-list standard MOFRR-SG-ACL
 permit 10.10.10.0 0.0.0.255


IOS > 15.2 is required for MoFRR.


IOS-XR
router pim
 address-family ipv4
  mofrr rib MOFRR-SG-ACL
!

ipv4 access-list MOFRR-SG-ACL
 10 permit ipv4 host 1.1.1.1 host 239.3.3.3



Links



Troubleshooting

Enable "debug ip mfib fs" and "debug ip mfib ps" on the receiver, and then send some pings from a source to an igmp join group on the receiver to check the results.



IPv6 Multicast


IOS
ipv6 multicast-routing

IOS-XR
multicast-routing
 address-family ipv6
  interface all enable



In IOS, all IPv6 interfaces are PIM enabled by default after enabling ipv6 multicast-routing.


IPv6 RP definition

IOS

ipv6 pim bsr candidate bsr 2002:2:2::2
ipv6 pim bsr candidate rp 2002:2:2::2

!
ipv6 pim rp-address 2002:2:2::2

IOS-XR
router pim
 address-family ipv6
  rp-address 2002:2:2::2
  bsr candidate-rp 2002:2:2::2 

  bsr candidate-bsr 2002:2:2::2


MLD

IOS
ipv6 multicast-routing
!interface Loopback0
 ipv6 mld join-group FF99::99


IOS-XR
multicast-routing
 address-family ipv6
  interface all enable
!

router mld
 interface Loopback0
  join-group ff99::99


MLDv2 is used by default.


Verification

R2#sh ipv6 mroute
Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group,
       C - Connected, L - Local, I - Received Source Specific Host Report,
       P - Pruned, R - RP-bit set, F - Register flag, T - SPT-bit set,
       J - Join SPT
Timers: Uptime/Expires
Interface state: Interface, State

(*, FF99::99), 00:00:08/00:03:21, RP 2002:2:2::2, flags: S
  Incoming interface: Tunnel4
  RPF nbr: 2002:2:2::2
  Immediate Outgoing interface list:
    Ethernet0/2, Forward, 00:00:08/00:03:21


R2#ping FF99::99
Output Interface: Ethernet0/2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FF99::99, timeout is 2 seconds:
Packet sent with a source address of 2002:2:2:27::2

Reply to request 0 received from 2002:2:2::7, 60 ms
Reply to request 1 received from 2002:2:2::7, 0 ms
Reply to request 2 received from 2002:2:2::7, 4 ms
Reply to request 3 received from 2002:2:2::7, 4 ms
Reply to request 4 received from 2002:2:2::7, 0 ms
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/13/60 ms
5 multicast replies and 0 errors.



Almost everything cli-wise is similar to IPv4.


Static mroutes

IOS
ipv6 route 2002:2:2::2/128 Tunnel0 multicast

IOS-XR
multicast-routing
 address-family ipv6
  static-rpf 2002:2:2::2 128 tunnel-te0 2002:3::1







NSF

IOS-XR
router pim
 nsf lifetime 30
!

router igmp
 nsf lifetime 30
!
router mld
 nsf lifetime 30



Generally, configure the IGMP NSF and PIM NSF lifetime values to be equal or larger than the query or join query interval, but less than the holdtime




Multipath

By default, if ECMP paths are available, the RPF for multicast traffic will be based on the highest IP address (aka highest PIM neighbor).

When the 'ip multicast multipath' command is configured, the multicast load splitting will be based on the source address of the stream. PIM Joins will be distributed over the different ECMP links based on a hash of the source address.

Multicast multipath must be enabled on the receiver side of the ECMP path.

IOS
ip multicast multipath

IOS
R2#sh ip rpf 19.19.19.19
RPF information for ? (19.19.19.19)
  RPF interface: FastEthernet0/0.24
  RPF neighbor: ? (20.2.4.4)
  RPF route/mask: 19.19.19.19/32
  RPF type: unicast (ospf 1)
  Doing distance-preferred lookups across tables
  Multicast Multipath enabled.
  RPF topology: ipv4 multicast base, originated from ipv4 unicast base


By default only the source address is used in the calculation. Better load-splitting can be achieved by using the "s-g-hash next-hop-based" options.

When the ip multicast multipath command is enabled, the presence of PIM hello message from neighbors is not considered; that is, the chosen RPF neighbor does not depend on whether or not PIM hello messages are received from that neighbor; it only depends on the presence or absence of an equal-cost route entry.

If using BGP and multicast, then you must also enable multipath on BGP.

If using static mroutes, then you need to somehow create two (or more) different static mroutes because only one is accepted. You can use a dummy ip address and two (or more) static ip routes in order to achieve this.


IOS
ip route 192.168.1.1 255.255.255.255 20.2.3.3
ip route 192.168.1.1 255.255.255.255 20.2.4.4

!
ip mroute 19.19.19.19 255.255.255.255 192.168.1.1


In the above example, multicast load-balancing occurs between 20.2.3.3 and 20.2.4.4 for source 19.19.19.19 (192.168.1.1 is the dummy address used).

Use "sh ip multicast rpf tracked" to verify the multiple rpf paths.



NTS: Multicast

Multicast




PIM-DM (Protocol Independent Multicast- Dense Mode) is defined in RFC 3973.
PIM-SM (PIM - Sparse Mode) is defined in RFC 4601.
PIM-SSM (PIM - Source Specific Multicast) is defined in RFC 4607.
BSR (BootStrap Router) for PIM is defined in RFC 5059.



Multicast Ranges

Multicast range:
  • 224.0.0.0/8
  • FF00::/8

Important ranges (IANA):
  • Link-local range (TTL=1)
    • 224.0.0.0/24 
    • FFx2::/16
  • SSM range:
    • 232.0.0.0/8
    • FF3x::/32 (FF3x::8000:0000  - FF3x::FFFF:FFFF)
  • GLOP range: 233.0.0.0/8
  • Admin-scope range: 239.0.0.0/8

Link-local addresses are not constrained by IGMP snooping. The same also applies to x.0.0.x or x.128.0.x (due to 32:1 mcast=>eth mapping).


GLOP range

GLOP addressing is defined in RFC 3180.

Every 16bit ASN has its own GLOP 233.X.Y.0/24 range.

i.e. for AS 12345, one hex=>dec and two dec=>hex conversions need to be made.

12345 => 0x3039
0x30 => 48 (X)
0x39 => 57 (Y)

AS 12345 = > 233.48.57.0/24

Organizations with a 32-bit ASN may apply for space in AD-HOC Block III (233.252.0.0 - 233.255.255.255) also known as Extended GLOP (EGLOP), or consider using IPv6 multicast addresses.



Multicast Routing Protocols

Main functionalities
  • setup multicast forwarding state
  • exchange information about the multicast forwarding state

Protocols
  • DVMRP
  • PIM-DM
  • PIM-SM
Expect to see only PIM-SM being used in most networks.


IOS
ip multicast-routing

IOS-XR
multicast-routing


Enabling multicast-routing on an interface in IOS-XR will enable PIM and IGMP automatically. There is no need to configure the "router pim" command (unless something extra is required, like MDT or RP), since the PIM mode it's automatically determined by the group range.

IOS-XR
GSR#sh pim group-map
Fri Jun  9 06:11:08.463 UTC

IP PIM Group Mapping Table
(* indicates group mappings being used)
(+ indicates BSR group mappings active in MRIB)

Group Range         Proto Client   Groups RP address      Info

224.0.1.39/32*      DM    perm     0      0.0.0.0
224.0.1.40/32*      DM    perm     1      0.0.0.0
224.0.0.0/24*       NO    perm     0      0.0.0.0
232.0.0.0/8*        SSM   config   1      0.0.0.0
224.0.0.0/4*        SM    static   0      0.0.0.0         RPF: Null,0.0.0.0


Each multicast group can be one of sparse, dense, bidir, ssm. Each interface can be many modes, each one depending on the egress multicast group.

In IOS-XR, the router itself is also listed as a pim neighbor with a "*".



PIM-SM RP

For PIM-SM to work properly, all routers in a domain must know and agree on the active RP for each multicast group (Group-to-RP mappings).

Group-to-RP mappings can be created using:
  • Static group-to-RP mapping
  • Auto-RP
    • uses dense-mode (configure "sparse-dense-mode" or "sparse-mode" & "ip pim auto-rp listener")
    • uses 224.0.1.39 for RP announcements (from RP to MA)
    • uses 224.0.1.40 for MA announcements (from MA to all PIM routers)
    • the priority of each RP cannot be defined (the RP with the higher ip address wins)
    • the interval/scope of Auto-RP announcements can be defined
    • use "ip multicast boundary ACL in/out filter-autorp" to filter Auto-RP announcements entering/leaving your network
  • PIM BSR (bootstrap router)
    • uses sparse-mode (configure "no ip pim dm-fallback" in dense environments)
    • uses 224.0.0.13 for BSR announcements (from BSR to all PIM routers)
    • unicast for RP announcements (from RP to BSR router)
    • the priority of each RP can be defined
    • the interval/scope of BSR announcements cannot be defined
    • use "ip pim bsr-border" to filter BSR announcements from entering/leaving your network
On hub-n-spoke networks, when auto-rp announcements must pass between the spokes, you cannot use nbma-mode, because this works only in sparse mode (and announcements are in dense). You have to use BSR or create a pim-enabled tunnel between the spokes.

Static RP and BSR are the most common ways to configure a Group-to-RP mapping.


Static RP

IOS
interface Loopback0
 ip pim sparse-mode
!
ip pim rp-address 1.1.1.1

IOS-XR
router pim
 address-family ipv4
  rp-address 1.1.1.1

  interface Loopback0
   enable



Auto-RP

IOS
interface Loopback0
 ip pim sparse-mode
!
ip pim send-rp-announce Loopback0 scope 10
ip pim send-rp-discovery Loopback0 scope 10




IOS-XR
router pim
 address-family ipv4
  auto-rp mapping-agent Loopback0 scope 10 

  auto-rp candidate-rp Loopback0 scope 10
  interface Loopback0
   enable


In IOS-XR, Auto-RP is not supported for VRFs.

In IOS, you can use an ACL to filter the auto-rp groups.

Auto-RP requires either sparse-dense mode or sparse mode and auto-rp listener (by default enabled in IOS-XR).


BSR


IOS
interface Loopback0
 ip pim sparse-mode
!
ip pim bsr-candidate Loopback0
ip pim rp-candidate Loopback0

IOS-XR
router pim
 address-family ipv4

  interface Loopback0
   enable
  !
  bsr candidate-bsr 1.1.1.1

  bsr candidate-rp 1.1.1.1


When static RP is configured together with Auto-RP or BSR for the same PR mappings, Auto-RP/BSR created mappings take precedence, unless "override" is configured with the static rp-address.



PIM-SSM


PIM-SSM uses PIM-SM + IGMPv3/MLDv2.

Summary
  • Receivers report interest for a particular source using IGMv3
  • PIM routers do RPF lookups for the source and join upstream towards the source
  • An SPT is created between the source and the receivers
  • Multicast traffic starts to flow from source to the receivers on the SPT

Detailed analysis

  1. Receiver
    1. sends an IGMPv3 Report (S,G) to the LAN
  2. Receiver DR
    1. receives the IGMP Report (S,G) from the Receiver
    2. adds the incoming IGMP interface to OIL for (S,G)
    3. performs RPF lookup for source S
    4. sends a PIM Join (S,G) to the upstream router out of the RPF interface
  3. Upstream Routers (from Receiver DR towards the Source)
    1. add the incoming PIM interface to OIL for (S,G)
    2. perform RPF lookup for source S
    3. send a PIM Join (S,G) to the next upstream router out of the RPF interface (*)
    4. ...

(*) This propagation of PIM Join messages our of the RPF interface continues until the source DR is reached or an upstream router has already multicast forwarding state for this group.


IOS
ip pim ssm default
!
interface X
 ip pim sparse-mode



IOS-XR
multicast-routing
 address-family ipv4
  interface X
   enable



SSM is enabled by default on IOS-XR for 232.0.0.0/8.

In IOS-XR, interfaces enabled under multicast-routing run PIM sparse-mode by default.



PIM-SM


Summary
  • A receiver asks for multicast data and an RPT (*,G) is built from the receiver DR to the RP
  • When the source transmits the multicast data, first packets are sent encapsulated into PIM Register messages by the source DR to the RP and then an SPT (S,G) is built from the RP to the source
  • When the multicast data reaches the receiver, there is a new SPT (S,G) built from the receiver DR directly to the source
  • Receiver DR sends a prune message to the RP to stop the initial RPT

Detailed analysis

Phase #1 (Receiver asks for multicast data)
  1. Receiver
    1. sends an (*,G) IGMP Report to the LAN
  2. Receiver DR Router
    1. receives the (*,G) IGMP Report from the Receiver
    2. adds the incoming IGMP interface to OIL for (*,G)
    3. performs RPF lookup for RP
    4. sends a (*,G) PIM Join to the upstream router out of the RPF interface
  3. Upstream Routers (from Receiver DR towards the RP)
    1. receive the (*,G) PIM Join from the downstream router
    2. add the incoming PIM interface to OIL for (*,G)
    3. perform RPF lookup for RP
    4. send a (*,G) PIM Join to the next upstream router out of the RPF interface (*)
Phase #2 (Source sends multicast data and Receiver receives it through the RP)
  1. Source S
    1. starts sending native multicast data (S,G) to the LAN
  2. Source DR Router
    1. receives native multicast data from the source
    2. adds the incoming multicast data interface to IIF
    3. encapsulates multicast data in PIM Register messages
    4. sends the PIM Register messages to the RP as unicast packets
  3. RP (with active RPT)
    1. receives and decapsulates the PIM Register messages
    2. sends the decapsulated native multicast data to the receiver down the RPT
  4. Receiver
    1. receives the native multicast data through the RP
  5. RP (with active RPT)
    1. performs RPF lookup for source S
    2. sends a (S,G) PIM Join to the upstream router (towards source) out of the RPF interface
  6. Upstream Routers (from RP towards the Source)
    1. receive the (S,G) PIM Join
    2. add the incoming PIM interface to OIL for (S,G)
    3. perform RPF lookup for source S
    4. send a (S,G) PIM Join to the next upstream router (towards source) out of the RPF interface (*)
  7. Source DR Router
    1. receives the (S,G) PIM Join
    2. starts sending native multicast data to the RP
  8. RP (with active RPT)
    1. receives duplicate multicast data (encapsulated from Source DR and native from source/upstream)
    2. sends a PIM Register-Stop message to the Source DR
  9. Source DR Router
    1. receives the PIM Register-Stop message from the RP
    2. stops sending PIM Register messages with encapsulated multicast data to the RP
  10. RP (with active RPT)
    1. receives only native multicast data
    2. sends the native multicast data to the receivers down the RPT
  11. Receiver
    1. receives the native multicast data through the RP
Phase #3 (Receiver receives the multicast data directly from the Source)
  1. Receiver DR Router
    1. receives multicast data (S,G) from source S through the RP
    2. performs RPF lookup for source S
    3. sends a (S,G) PIM Join to the upstream router out of the RPF interface 
  2. Upstream Routers (from Receiver DR towards the Source DR)
    1. receive the (S,G) PIM Join from the downstream router
    2. add the incoming PIM interface to OIL for (S,G)
    3. perform RPF lookup for source S
    4. send a (S,G) PIM Join to the next upstream router out of the RPF interface (*)
  3. Source DR Router
    1. receives the (S,G) PIM Join from the downstream router
    2. starts sending native multicast data to the Receiver DR Router
  4. Receiver DR Router
    1. receives duplicate multicast data (from source DR through SPT and from RP through RPT)
    2. sends a PIM Prune (S,G,RPT) to the upstream router out of the RPF interface
  5. Upstream Routers (from Receiver DR towards the RP)
    1. receive the PIM Prune (S,G,RPT)
    2. remove the incoming PIM interface from OIL for (*,G)
    3. if OIL is null, send a PIM Prune (S,G) to the upstream router out of the RPF interface
  6. RP
    1. receives the PIM Prune (S,G)
    2. removes the incoming PIM interface from OIL for (*,G)
    3. if OIL is null, sends a PIM Prune (S,G) to the upstream router out of the RPF interface
  7. Source DR
    1. receives the PIM Prune (S,G)
    2. removes the incoming PIM interface from OIL for (S,G)

(*) This propagation of PIM Join messages our of the RPF interface continues until the RP or the Source DR is reached or an upstream router has already multicast forwarding state for this group.

PIM Prune messages might not be sent, if there is another active multicast state for the same group in the router.

The Source DR periodically sends a PIM Null-Register message (without any multicast data inside) to the RP, in order to inform it that the source is still active.



IOS
interface X
 ip pim sparse-mode



IOS-XR
multicast-routing
 address-family ipv4
  interface X
   enable




OIL = Outgoing Interface List
IIF = Incoming Interface

In the shortest path tree (SPT), the root of the tree is the source.
In the shared path tree (RPT), the root of the tree is the RP.

PIM Joins are sent to 224.0.0.13.

The threshold for switching from the RPT to SPT is 0 by default, which means once the Receiver DR receives the first multicast packet and learns the source, it sends a (S,G) PIM Join towards the source. When is starts receiving multicast data from the SPT, it sends a PIM Prune for traffic received via the RPT towards the RP.




PIM Bidir

PIM Bidir is significantly simpler in operation than PIM-SM.

It eliminates the maintenance of  (S,G) entries (only  (*,G) are kept) and there's no data driven events hence packets never need to be signaled and preserved (much more scalable for many-to-many applications).

Bidir PIM uses the Designated Forwarder (DF) election mechanism (based on routing protocol cost to the RP) to elect a single router on each link, which becomes responsible for the following tasks:
  • picking up packets from the link and forwarding them upstream towards the RP
  • forwarding downstream multicast packets from the RP onto the link

When configuring both sparse and bidir groups, you need to explicitly define them, because everything excluded from bidir is dense by default.

IOS
ip pim bidir-enable
ip pim rp-address 1.1.1.1 bidir


IOS-XR
router pim
 address-family ipv4
  rp-address 1.1.1.1 bidir



In some IOS-XR releases you might need to define the mcast bidir range of group addresses.

IOS
R2#sh ip pim rp map
PIM Group-to-RP Mappings

Group(s): 224.0.0.0/4, Static, Bidir Mode
    RP: 1.1.1.1 (?)


IOS-XR
GSR#sh pim group-map
Tue Feb  4 13:57:55.368 UTC

IP PIM Group Mapping Table
(* indicates group mappings being used)
(+ indicates BSR group mappings active in MRIB)

Group Range         Proto Client   Groups RP address      Info

224.0.1.39/32*      DM    perm     0      0.0.0.0
224.0.1.40/32*      DM    perm     1      0.0.0.0
224.0.0.0/24*       NO    perm     0      0.0.0.0
232.0.0.0/8*        SSM   config   0      0.0.0.0
224.0.0.0/4*        BD    config   1      1.1.1.1         RPF: Gi0/2/1/2.28,2.2.28.2
224.0.0.0/4         SM    static   0      0.0.0.0         RPF: Null,0.0.0.0



You will see only (*,G) entries for the bidir groups, no (S,G) entries.



PIM Register Tunnels

In latest software releases, PIM uses tunnel interfaces for RP Register communication. You can use "sh ip pim tunnel" in order to verify the PIM connectivity, either inside or outside a vrf. If no tunnel exists but should exist, then there is probably something wrong.

IOS
R1#sh ip pim tunnel
Tunnel0
  Type  : PIM Encap
  RP    : 10.0.0.1*
  Source: 10.0.0.1
Tunnel1*
  Type  : PIM Decap
  RP    : 10.0.0.1*
  Source: -
 

R1#sh ip pim vrf VPN tunnel
Tunnel1
  Type  : PIM Encap
  RP    : 10.0.0.1
  Source: 10.1.7.1


R1#sh int tun1 | i protocol/transport
  Tunnel protocol/transport PIM/IPv4



IOS-XR
GSR#sh pim tunnel info all
Fri Jun  9 06:04:51.319 UTC

Interface           RP Address      Source Address

Encapstunnel0       10.0.0.1        10.0.0.1
Decapstunnel0       0.0.0.0          -


The router acting as RP should have at least two PIM tunnels: one for Encapsulation (usually src=RP) and another one for Decapsulation. All other PIM routers should have only one for Encapsulation (src=local PIM address, dst=RP).



IGMP

You can use the following as multicast receiver.

IOS
interface X
 ip igmp join-group 224.1.1.1


IOS-XR
router igmp
 interface X
  join-group 232.1.1.1 192.168.1.1


PIM (sparse) is also required on the interface where IGMP is enabled.

"ip igmp static-group x.x.x.x" can also be used, if we want to avoid having the multicast traffic being processed by the router.

IGMP (v3) for SSM requires to also define the source of multicast traffic.

In IOS, when using multicast ping to test connectivity, the multicast packets go out through all multicast enabled interfaces by default (regardless of the source ip/interface chosen in CLI). If you want to send it out through a specific interface then you need to use extended ping and choose a specific interface in the "Interface" option.

IOS
R1#ping
Protocol [ip]:
Target IP address: 232.1.1.1
Repeat count [1]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Interface [All]: FastEthernet0/0

Time to live [255]:
Source address: 1.1.1.1