Introduction: multicast communication
Most everyday Internet applications use a one-to-one, or unicast, model. When you browse a website, your computer sends a request to one server, and the server directs the reply to that computer. Unicast works well for one receiver but requires a separate stream for every receiver of the same content.
In a live broadcast, a provider using unicast would create a separate copy of the video stream for every viewer. A large audience then increases the load on the provider's server and links even when every copy contains identical data.
Broadcast communication sends a packet to every device on a local network segment. Receivers do not opt in to the transmission. Broadcast can support local discovery, but on a large segment it increases traffic and host processing for devices that do not need the data.
Multicast routing delivers one transmission to a selected receiver group. It supports efficient one-to-many and many-to-many communication. A source sends a packet to the group address, and routers replicate it only where the distribution tree branches to several interfaces. Hosts outside the group do not receive that traffic.
In IPv4, the group address is the destination while the source address still identifies the sender. Routers maintain forwarding state for the group, source, and outgoing interfaces. One packet can therefore be copied only where needed instead of being sent as a separate stream along the whole path to each host.
Multicast does not automatically deliver traffic to every Internet host. The receiver needs membership state, the router needs a valid RPF interface, and downstream routers need to build the appropriate tree branches. These conditions limit the scope of the transmission and allow receivers to share packets.
Core multicast concepts
Multicast routing can be described using a group, a group address, and a distribution tree.
- Multicast group: This is a collection of receivers interested in a particular data stream. A host can join or leave the group, while the router maintains membership state for the local segment.
- Multicast group address: A group is identified by an IP address used as the destination address of multicast packets. A special IPv4 range, known as , is reserved for this purpose. The range is from to . When a source sends a packet to a group address, multicast routing delivers it to active members of that group.
- Distribution tree: The network builds a loop-free path from the source to the receivers. A packet is sent once down each branch, and a router replicates it where the tree branches to several interfaces.
A group address does not identify one host. A host records its interest in the local router, which uses that state to select outgoing interfaces. Multicast addresses also have scope restrictions, so not every packet in the Class D range is forwarded beyond the local segment.
IGMP: host group membership
A local router needs to learn that a host wants to join a multicast group. The protocol that manages IPv4 host and router membership on the local segment is the Internet Group Management Protocol (IGMP).
IGMP operates between a host and its directly connected last-hop router. It does not build a path between routers; it reports local receiver state to the router.
IGMP message exchange
- The router sends a query: Periodically, the router sends an IGMP Membership Query to , the all-hosts multicast address on the local network. The query refreshes membership state.
- Hosts send reports: When an application joins a group such as , the host operating system sends an IGMP Membership Report for that address . A host can also send a report in response to the router's periodic query.
- The router maintains state: The router stores the groups with at least one active member on the local network. It uses reports and timers to decide whether to forward traffic for each group.
IGMP versions and leaving a group
Later IGMP versions changed group-leave handling and source filtering:
- IGMPv1: It defined no explicit leave message. A host stopped sending reports, and the router removed the state after the relevant timers expired. This delayed stopping traffic after the last receiver left.
- IGMPv2: It introduced an explicit Leave Group message for group , allowing a router to check more quickly whether other hosts remain in the segment. It also introduced querier election on networks with multiple routers.
- IGMPv3: It added source filtering used by Source-Specific Multicast (SSM). A host can specify group and source from which it wants to receive data.
A querier sends general queries, and hosts respond after a delay selected from the protocol parameters. A router may shorten state after a Leave message, but it must check whether another host still reports membership. In IGMPv3, a report contains source records, so the router can forward only a selected (S,G) channel.
PIM: building the distribution tree
IGMP reports local receivers to the router. A multicast routing protocol builds the tree between routers; one such protocol is Protocol Independent Multicast (PIM).
PIM does not define its own unicast path metric. Instead, it uses the existing built by an IGP such as OSPF or by a static route. PIM-DM and PIM-SM differ in how they create state and attach receivers to the tree.
PIM uses next-hop information toward the source or RP. RPF checks select the incoming interface, while group state selects outgoing interfaces. A router does not forward a packet through every PIM-enabled interface merely because the interfaces are enabled.
PIM Dense Mode (PIM-DM): flooding and pruning
Dense Mode assumes that receivers are distributed widely through the network. Source traffic is initially forwarded through the PIM domain, and routers without receivers send Prune messages upstream.
PIM-DM first floods traffic and then removes interfaces without receivers from the forwarding state. Receivers can later rejoin when the state is refreshed.
How PIM-DM Works
- Initial flood: When a source starts sending multicast traffic, its first-hop router forwards it through PIM-enabled interfaces subject to the RPF check. Routers that receive the packets continue forwarding toward downstream segments.
- Prune messages: A router with no local receivers and no downstream neighbors interested in the group sends a Prune message to the upstream router from which it received the traffic.
- Building the tree: The upstream router removes the interface named by Prune from the forwarding state for the group. Further Prune messages reduce the tree to branches leading to active receivers. The result is a source-based tree called the Shortest Path Tree (SPT).
- State refresh: The pruned state is controlled by PIM-DM timers and State Refresh messages. When the state expires, an interface can receive traffic again, allowing new members to join the group.
PIM-DM state describes a source and group as (S,G). A router can use Graft to restore a pruned branch quickly when a receiver appears. RPF, Prune, Graft, and State Refresh limit loops and keep the tree current as membership changes.
Pros and Cons of PIM-DM
- Pro: Few configuration elements and fast initial delivery in a domain with many receivers.
- Con: Initial flooding consumes bandwidth on every segment, including segments without receivers. This limits PIM-DM scalability, so larger domains often use other modes.
PIM Sparse Mode (PIM-SM): on-demand trees
Sparse Mode assumes that only a fraction of potential receivers request a given stream. PIM-SM creates state after a receiver request, limiting forwarding to branches selected by Join messages.
In PIM-SM, the receiver router sends a Join toward the RP, and the source router registers the source with the RP. A shared tree is built first, and an SPT can be built later.
The Rendezvous Point (RP)
PIM-SM uses a router called the Rendezvous Point (RP). The RP is the initial point for a multicast group, and the group-to-RP mapping must be available to routers in the PIM domain.
The mapping can come from configuration or from a selection mechanism used in the PIM domain. Routers must know the RP address for the groups they support. The RP maintains (*,G) state, while source routers can register sources with it using Register messages.
How PIM-SM Works
- Receiver joins: A host sends an IGMP Report. Its local router, knowing the RP, sends a PIM Join toward it. Each router builds a branch connecting the receiver to the RP. The initial state is the Shared Tree (*,G).
- Source sends data: The source sends multicast packets, and its first-hop router encapsulates initial packets in unicast Register messages addressed to the RP. The RP learns that the group has an active source.
- RP forwards traffic: The RP receives source data and Join state from receivers. It forwards traffic down the Shared Tree. Initially the path may pass through the RP even when a shorter path exists between source and receiver.
- Switchover to the Shortest Path Tree (SPT): After receiving traffic, the receiver router learns the source address from the packet header. If policy and implementation select an SPT, it uses the unicast table and sends a Join directly toward the source. This builds a Shortest Path Tree (S,G) branch.
- Pruning the shared tree: Once traffic arrives through the SPT, the receiver router sends a Prune toward the RP to stop duplicate packets from the shared tree. Forwarding state is limited to the selected branch.
In the classic Any-Source Multicast (ASM) mode, PIM-SM receives a group request without a source. In Source-Specific Multicast (SSM), the receiver identifies both source and group, so the router creates (S,G) state without a shared RP tree. Both modes use Join and Prune state, but source discovery and the role of the RP depend on the operating mode.
Pros and Cons of PIM-SM
- Pro: Scalable with distributed receivers. Traffic is forwarded after membership state is created, and trees can switch to an SPT.
- Con: Configuration requires group-to-RP mapping and additional state. The first packets may pass through the RP before the SPT is built.
Reverse Path Forwarding (RPF): incoming-interface check
In PIM, a mechanism that limits loops and duplicate packets is Reverse Path Forwarding (RPF), which checks the interface through which traffic from a source should arrive.
RPF compares the incoming interface with the interface selected by the unicast routing table. For (S,G) state, the router checks the route to source S. For (*,G) state in PIM-SM, the target can be the RP because the shared-tree Join is directed to the RP.
The router reads the packet's source IP address and looks it up in the unicast table. If the packet arrived through the RPF interface, the check passes and PIM can forward it through outgoing interfaces. If it arrived through another interface, the packet is discarded because it may be a duplicate or the result of a routing loop.
After a successful RPF check, the router selects outgoing interfaces from its multicast state. If several routers on a shared segment could forward the same traffic, the Assert mechanism selects the forwarding device. RPF controls the input, while the outgoing-interface list controls further distribution.
A change to the unicast route can change the RPF interface and require multicast state to be recalculated. This is why PIM is protocol independent: unicast routing supplies path information, while PIM separately maintains group membership, Join and Prune state, and packet replication rules. RPF alone does not create membership and does not determine every outgoing interface. In IPv4, IGMP supplies local host membership, while PIM exchanges forwarding state between routers. ASM and SSM then determine whether the receiver names only a group or both a source and a group for delivery.