Thursday 7 May 2015

Multicast Notes

Well Known Multicast Addresses

224.0.0.1 - All Hosts
224.0.0.2 - All Multicast Routers
224.0.0.9 - RIPv2 Routers
224.0.0.10 - EIGRP Routers
224.0.0.12 - HSRPv2
224.0.0.13 - PIM Routers
224.0.0.22 - IGMPv3
224.0.1.1 - NTP
224.0.1.39 - Cisco-RendezvousPoint-Announce
224.0.1.40 - Cisco-RendezvousPoint-Discovery
232.0.0.0/8 - Reserved for SSM
233.0.0.0/8 - GLOP address range

PIM (Protocol Independent Multicast)
  • Protocol independent means that it can work with any unicast routing protocol 
  • Pim can be implemented in three modes: sparse mode, dense mode and sparse-dense mode.
Dense mode:
  • It uses flood and prune method. Initially the multicast packets will be flooded throughout the network until the packet reach the leaf routers.
  • The initial flooding ensures that every router has a chance to continue to receive multicast traffic for a specific group. If a leaf router has no hosts that need this multicast group's traffic. the leaf router will send a Prune message to the upstream router. 
  • If the upstream router receiving the prune also has no hosts that need this multicast group's traffic, that router will then send a Prune to its upstream neighbour as well.
  • In this mode, the tree gets build from the root down to the branches. One can see a (S,G) entry as source information gets flooded across the network. 
Sparse mode:
  • It uses two type of trees. A shared tree (*,G) and a source tree (S,G). When a server starts sending the multicast feed, the receiving device will register the source to the RP (Rendezvous point) by using PIM register message. 
  • At this point, RP will create a (S,G) entry in it's mroute table.
  • when a host sends a request to join a specific multicast group. The device which receives the IGMP report message will create a (*,G) entry towards RP.
  • When RP becomes aware that there is a host requesting the specific multicast feed for which it has (S,G) entry. It will start sending the packets towards the host.
  • On receipt of the first multicast packet, the last hop device will switch over from shared tree (*,G) to SPT (S,G).
  • The traffic will now flow from the sender to the receiver without traversing through RP.
  • This behaviour can be changed by using "ip pim spt-threshold" command. 
Sparse-Dense mode:
  • When the network needs to support both dense and sparse mode, once can configure the interfaces on the devices with sparse-dense mode. This means that each multicast group will either use Dense mode or Sparse mode.
  • If there is no RP for a group, it will default to dense mode

RPF (Reverse Path Forwarding) Check
  • The different between unicast and multicast is that the unicast packets is routed towards destination while multicast packets is routes "away" from the source.
  • The multicast packets can arrive on a device from multiple direction, the device has to decide which path to use to reach the source. The RPF check ensure that and prevents a potential loop in the multicast network.
  • The RPF Check is run against incoming multicast packets. The device examines the interface that the packet arrived on. If the packet comes in on an upstream interface - that is, an interface found on the reverse path that leads back to the source (based on Unicast routing table), the packet passes the check and will be forwarded. If the packet comes in on any other interface, the packet is dropped.
  • One way to get around RPF issue would be to ensure that all interfaces on device have multicast enabled on them however this may not always be possible.
  • The other way to resolve the issue is to use static multicast route by using "ip mroute [source subnet] [mask] [incoming interface] ". One can also use mBGP to achieve the same.
IGMP (Intenet Group Management Protocol)
  • IGMP is used to allow end host to communicate to the router to inform that it wants to subscribe to a specific multicast feed.
  • There are three versions of IGMP in today's networks.
                                               IGMP v1: RFC 1112
                                               IGMP v2: RFC 2236
                                               IGMP v3: RFC 3376


IGMPv1:
  • A host running IGMP v1 will send a Membership Report message to its local router, indicating what multicast group the host wishes to join. 
  • If there are multiple routers on the segment, there will be a router selected as IGMPv1 querier. This router will send a query onto segment every 60 seconds.
  • The query will be sent on the 224.0.0.1 (all hosts). A host must respond to this query with membership request if it wants to join a multicast group or wants to continue it's membership in a group.
  • One of the limitation of this version is that there is no way for a host to leave a group. It will take upto 3 minutes after the client has stopped listening before the traffic flow will stop.

IGMPv2:
  • The major difference between v1 and v2 is that v2 hosts that wish to leave a group do not just stop sending membership reports. There is no three minute wait for the membership to age out.
  • IGMPv2 hosts send a leave message to the multicast group 224.0.0.2 (all routers) on the segment.

IGMPv3:

  • The major improvement on v3 is that this version added support for SSM (Source Specific Multicast). This allows hosts to not only specify the group they wish to subscribe but also the source of the multicast traffic.

RP Discovery
  • RP (Rendezvous Point) address can be statically assigned on each device in the multicast network however it't not an ideal method if the network has many devices.
  •  There are couple of dynamic methods to propagate RP information in the network.
                         i. AutoRP (Cisco Proprietary)
                         ii. BSR (Bootstrap Router)

AutoRP:
  • This method consists two parts, configuration of the mapping agent and candidate RP.
  • The candidate RP is the router which wants to become the (Rendezvous Point).  This can be configured using "ip pim send-rp announce". The candidate RP will communicate with the mapping agent on 224.0.1.39. 
  • The mapping agent can be configured by using "ip pim send-rp discovery". "The mapping agent will propagate this information on the network using multicast address 224.0.1.40.
  • The issue with AutoRP is that you need the multicast to setup multicast. The solution which Cisco came up with was the command "ip pim autorp listener". This command allows all groups to run in sparse mode apart from the ones needed for AutoRP (224.0.1.39 & 224.0.1.40).
BSR:
  • PIMv2 offers an open-standard method of RP selection which is called Bootstrap router (BSR).
  • It is very similar to AutoRP where instead of Candidate RP and Mapping agent, we have Candidate RP and BSR candidate. 
  • The commands to configure Candidate RP and BSR candidate are "ip pim rp-candidate" and "ip pim bsr-candidate" respectively.
  • BSR message gets flooded hop-by-hop throughout the entire network using PIM.
BIDIR-PIM
  • Bidirectional PIM is an extension of PIM-SM. In this mode multicast traffic can flow in both directions. The sources of the multicast feeds can also be the potential receivers as well and vice versa.
  • There will not be (S,G) entry on the routers running BIDIR PIM. The router will only create (*,G) entry.
  • PIM-Bidir can send and receive multicast traffic for the same group along the same shared-tree.
SSM (Source Specific Multicast)
  • In SSM, the host can select the source of the multicast in addition to the multicast stream. The host must support IGMPv3.
  • As the host decide the source while sending the IGMP membership report, there will not be any (*,G) entry created on the router. All the routers along the path will only have (S,G).
  • Normally 232.0.0.0/8 range is used for SSM.
Anycast RP & MSDP
  • Anycast RP provides failover for RP and allows for load-balancing. In this method two or more RPs are configured with the same IP address on loopback interfaces. The sender and receiver of the multicast feed will select the "nearest" RP.
  • Both the RPs can share information about active source using MSDP (Multicast Source Discovery Protocol)
  • The MSDP peer can be configured by using "ip msdp peer <<peer IP>> connect-source <<Local loopback IP>>". The loopback interfaces for MSDP peering must be different than the ones used as RP address.
Mapping of Multicast IP to MAC address
  • OUI of multicast MAC is always 01-00-5e.
  • The range of multicast MAC address is 01-00-5e-00-00-00 through 01-00-5e-7f-ff-ff.
  • To convert Multicast IP address to MAC address                                 i. Convert ip address to binary                                                                     e.g. for 224.0.0.12 it will be 11100000 00000000 00000001 00001100   ii. Convert the last 23 bits into HEX. The 25th bit is always set to 0 (the bit after OUI)                                                                                          e.g. 0000000 00000001 00001100                                                          Hex: 00               01             0c                                                         iii. The corresponding MAC address is 00-01-5e-00-01-0c
  • There can be few cases where a single MAC address can represent multiple multicast IP addresses. (e.g. 224.0.0.12 and 224.128.1.12, corresponding MAC address is the same for both).                                          

No comments:

Post a Comment