# Routing protocols and architectures/Multicast routing2
## Multicast routing protocols

* DVMRP: DV (TRPB, RPM), unicast-protocol-independent, source-specific tree;
* MOSPF: LS, works on OSPF protocol, source-specific tree;
* PIM-DM: DV (RPM), unicast-protocol-independent, source-specific tree;
* PIM-SM: CBT, unicast-protocol-independent, hybrid between shared and source-specific tree;
* BGMP: BGP-based inter-domain multicast routing protocol.

## DVMRP

Distance Vector Multicast Routing Protocol (DVMRP) was the first multicast routing protocol, and was used at the origins in Multicast backbone (Mbone), a virtual network born in 1992 in the IETF scope which relies for transmission on the same physical structure as the Internet to provide users with the possibility to exploit multicast for multimedia communications.
DVMRP is based on the DV algorithm:
* version 1: it adopts TRPB;
* version 3: it adopts RPM.
The DVMRP protocol instance is run in parallel with the unicast protocol instance: DVMRP ignores routing information from other protocols, and computes routes which can differ from the ones used for unicast traffic.
It uses a metric based on the hop count, that is the number of mrouters which speak DVMRP. In DVMRP tunnels can be manually configured: the path connecting two DVMRP neighbors can include routers not supporting DVMRP (or on which DVMRP is disabled):
* local end-point: it specifies the mrouter at the beginning of the tunnel;
* remote end-point: it specifies the mrouter at the other end of the tunnel;
* metric: it specifies the cost measure of the tunnel;
* threshold: it specifies the minimum TTL value which a packet needs to have in order to be routed through the tunnel → it allows to define the packet visibility: packets which must not exit the corporate network are generated with a TTL equal to the threshold.

## MOSPF

Multicast OSPF (MOSPF) is a multicast routing protocol based on the LS algorithm which extends OSPF, enabling single routers to have a full knowledge of the network topology and costs related to single links.
MOSPF is backward-compatible with OSPF: MOSPF routers can be mixed with OSPF-only routers, although multicast packets are forwarded only among MOSPF routers and the paths chosen for multicast packets do not cross OSPF-only routers.
MOSPF adds LSA type 6:
* MOSPF internal routers produce LSAs type 6 to inform the other routers within their area of multicast groups being active on their networks;
* MOSPF ABRs produce LSAs type 6 to inform the other routers within area 0 of multicast groups being active on their edge areas (even by aggregation).

## PIM

Protocol Independent Multicast (PIM) directly uses tables containing routing information independently of the underlying unicast protocol (DV or LS) which has built them.
It exists in two versions, incompatible among them, dealing with different issues related to spatiality of receivers:
* Dense Mode (DM):
** it is suitable for small networks (LAN/MAN) with a lot of concentrated receivers;
** it is greedy in terms of bandwidth: packets can be forwarded to areas not interested in the particular multicast group;
** it adopts the DV-based RPM algorithm (like DVMRPv3);
** Implicit Join Protocol: in the absence of explicit Prune messages, packets are forwarded to a certain network;
** Prune messages should be generated to stop multicast traffic (like DVMRP);
* Sparse Mode (SM):
** it is suitable for wide networks (WAN) with few scattered receivers;
** it limits as much as possible the bandwidth overhead: it never uses flooding;
** it is an evolution to the CBT algorithm: it always starts from a shared tree, which becomes a source-specific tree when advantageous;
** Explicit Join Protocol: in the absence of explicit Join messages, packets are not forwarded to a certain network (routing information however goes to all routers, not only the ones which will receive traffic);
** Join messages should be generated to start multicast traffic (like MOSPF).

### PIM-SM

PIM-SM handles two kinds of distribution trees:
* RP-Tree (RPT): it is the shared tree used at the beginning for all the packets of the multicast group, but is not optimized based on the source → the first packets of the transmission can be delivered in a short time to receivers without having to wait for the tree computation:
** no shortest paths are used;
** traffic is centralized;
** one tree is corresponding to each multicast group;
* Shortest-Path Tree (SPT): it is the source-specific tree built at a later time if routers believe it is convenient (it is not mandatory):
** shortest paths are used;
** traffic is distributed;
** one tree is corresponding to each (group, source) pair.
PIM-SM defines three special nodes:
* rendez-vous point (RP): it is the core router, elected based on an algorithmic formula starting from a list called RP-set, which is in charge of:
** receiving Join messages by DRs;
** receiving registration requests by sources;
** receiving and sending to DRs the first multicast data packets transmitted by a source;
* designated router (DR): it is the router, elected based on the shortest path toward the RP (or on the higher IP address if there is a tie), which is in charge of:
** receiving subscription requests by hosts in a certain LAN;
** sending the Join message to the RP to join the RPT;
** sending the Join message to the source to join the SPT;
** sending the Join message periodically to adapt to group changes;
* bootstrap router (BSR): it is the router, elected based on the best administrative cost (or on the higher IP address if there is a tie), which is in charge of distributing the RP-set to the whole PIM-SM domain.

#### Algorithm
##### RPT

* subscription of DRs as receivers: each DR sends a Join message to the RP;
* registration of the source as a transmitter: the source sends a registration request to the RP;
* registration of the RP as a receiver: the RP sends a Join message to the source;
* transmission along the RPT: the source sends in multicast the first data packets, forwarded by intermediate routers up to the RP;
* propagation along the RPT: the RP propagates in multicast the received data packets, forwarded by intermediate routers up to the DRs.

##### SPT

* subscription of DRs as receivers: each DR sends a Join message to the source;
* transmission along the SPT: the source sends in multicast data packets, forwarded by intermediate routers to each DR (besides the RP);
* detachment from the RPT: each DR sends a Prune message to the RP;
* joining to the SPT: another DR sends a Join message to the RP, then sends a Join message to the source.