Chapter 13 · Part IV · Engineered paths

Multicast routing

A television channel, a market-data feed or a software image going to a thousand machines: the same bytes, wanted by many receivers at once. Multicast sends each packet across each link once and lets the routers copy it only where the paths to the receivers split. This chapter is about how routers learn who is listening, how they build the tree that carries the copies, and the one check that keeps that tree from turning into a storm.

268,435,456IPv4 group addresses in 224.0.0.0/4: the top four bits are fixed at 1110, which leaves 28 bits to name groups
32IPv4 groups that share every Ethernet multicast address, because only the low 23 of those 28 bits are copied into the MAC
232/8The block reserved for source-specific multicast, where a receiver names the source as well as the group and no rendezvous point is needed

Common mix-up: the multicast routing check looks backwards. A unicast router asks "where is the destination?" and looks up the destination address. A multicast router first asks "did this packet arrive on the interface I would use to reach its source?" and looks up the source address. If the answer is no, the packet is dropped, however correct its destination looks.

The problem

One stream, many receivers

This chapter assumes you know how group addresses fit into the IPv4 and IPv6 address space, which IP addresses on networks.jelia.nyc covers, and what a broadcast domain is, which Ethernet on networks.jelia.nyc covers. Here we go past the address ranges and into the routers.

There are four ways to get one stream to many receivers. Replicated unicast is what most of the internet does: the sender opens one connection per viewer and sends a separate copy to each. It is simple and works everywhere, but the sender's link carries N copies, and so does every link that several of those copies share. Broadcast sends one copy to every host on a link, wanted or not, and stops at the first router. Multicast sends one copy addressed to a group; routers forward it only toward links where someone has asked to receive that group, and copy it only where the tree branches. Anycast, which route selection touches on, is the opposite case: one of many servers answers one client.

The saving is easy to state. Under replicated unicast, every link carries one copy for each receiver whose path crosses it. Under multicast, every link on the tree carries exactly one copy.

unicast load on link ℓ = r(ℓ) × b   ·   multicast load = b
Here b is the stream's bit rate and r(ℓ) is how many receivers sit downstream of link ℓ. The closer a link is to the source, the bigger r(ℓ) is, so the saving is largest exactly where the traffic is heaviest.

Worked example. A 5 Mb/s video channel goes to 2,000 set-top boxes behind one headend router. Replicated unicast puts 2,000 × 5 = 10,000 Mb/s, ten gigabits a second, on the headend's uplink. Multicast puts 5 Mb/s on it, plus one copy on each downstream link that has at least one viewer. That ratio is why every IPTV operator runs multicast inside its own network, even though the public internet does not.

MethodCopies on the sender's linkWho gets itCrosses routers?
Replicated unicastN, one per receiverExactly the N receiversYes, everywhere
Broadcast1Every host on the linkNo
Multicast1Hosts that joined the groupYes, where multicast routing runs
Anycast1One nearest server of manyYes
Naming a group

Addresses that name a conversation

RFC 1112, published in August 1989, set out the model that still holds. A multicast address does not name a machine; it names a host group, a set of zero or more receivers that can change at any time. Anyone may send to a group without joining it. Receivers join and leave on their own, and the sender never learns who they are. In IPv4 the groups live in 224.0.0.0/4, the old "class D", from 224.0.0.0 to 239.255.255.255. IANA divides it further.

BlockNameWhat it is for
224.0.0.0/24Local network controlLink-local protocol traffic, never forwarded by routers whatever the TTL: 224.0.0.1 all systems, 224.0.0.2 all routers, 224.0.0.5 and .6 OSPF, 224.0.0.13 all PIM routers, 224.0.0.22 IGMPv3 reports
224.0.1.0/24Internetwork controlProtocol groups that may be routed, such as NTP's 224.0.1.1
232.0.0.0/8Source-specific multicastGroups that only make sense together with a named source, (S,G); RFC 4607
233.0.0.0/8GLOPStatic groups derived from a 16-bit AS number
239.0.0.0/8Administratively scopedPrivate groups that an organization keeps inside its own boundary, the multicast cousin of 10.0.0.0/8; RFC 2365

IPv6 builds scope into the address itself. Every multicast address starts with FF, then a flags nibble and a scope nibble. FF02::1 is all nodes on this link; FF05::2 is all routers in this site; FF0E:: addresses are global. RFC 4291 defines the scopes, and RFC 4607 sets aside FF3x::/32 for source-specific use. A router never forwards a packet beyond the scope its address names, which makes the boundary a property of the address and not of a filter someone has to remember to write.

From group to Ethernet address

On a LAN a multicast IP packet still needs a destination MAC address, and that address has to be computable without ARP, since no single host owns the group. RFC 1112 fixed the rule: take the Ethernet prefix 01:00:5E, set the next bit to zero, and copy the low 23 bits of the group address into the remaining 23 bits. A group has 28 significant bits, so 5 bits are simply thrown away, and 25 = 32 different groups land on every MAC address. A host's network card filters on the MAC, so a host that joined 239.1.1.1 will also hear 224.1.1.1, 225.129.1.1 and 29 others, and its IP stack has to discard the unwanted ones. IPv6 uses 33:33 followed by the low 32 bits of the group, per RFC 2464.

Go deeper: why only 23 bits

IANA holds one IEEE organizationally unique identifier, 00-00-5E, which gives it 224 multicast MAC addresses, 01-00-5E-00-00-00 to 01-00-5E-FF-FF-FF. RFC 7042 records how they are used: only the lower half, 01-00-5E-00-00-00 to 01-00-5E-7F-FF-FF, is assigned to IPv4 multicast. Half of a 24-bit space is a 23-bit space, so 23 bits of the group are all that fit; part of the upper half went to MPLS multicast. The cost is the 32-to-1 overlap, which matters most when two busy applications pick groups that collide: a switch filtering on MAC cannot tell them apart. Choosing groups that differ in their low 23 bits avoids it.

Instrument 1

Map a group to its MAC

Type an IPv4 group (224.0.0.0 to 239.255.255.255) or an IPv6 multicast address (starting FF). The mapper classifies it, draws which bits survive into the Ethernet address, and, for IPv4, lists all 32 groups that end up on the same MAC.

Ethernet MAC–
Block–
Groups on this MAC–

    Membership

    Who is listening?

    A router does not need to know every receiver. It needs to know, for each of its LAN interfaces, whether at least one host there wants a group. Hosts tell it with IGMP, the Internet Group Management Protocol, in IPv4, and with MLD, Multicast Listener Discovery, in IPv6. The conversation has three moves.

    • Report (join). A host that wants a group sends a Membership Report. It does not wait to be asked.
    • Query. One router per LAN, the querier (the one with the lowest address), periodically asks everyone on the link which groups they want. Hosts answer after a random delay; in IGMPv2 a host that hears someone else report the same group stays quiet, because one answer is enough.
    • Leave. A host that is done sends a Leave (IGMPv2) or a report that changes its state (IGMPv3). The router cannot know whether that was the last listener, so it sends a group-specific query and waits a short time. Silence means nobody is left, and the router stops forwarding.

    IGMPv2 lets a host say only "I want group G". IGMPv3, first published as RFC 3376 in 2002 and now specified by RFC 9776 (March 2025), lets it say "I want G, but only from these sources" (INCLUDE mode) or "I want G from anyone except these" (EXCLUDE mode). That source list is what makes source-specific multicast possible. IGMPv3 reports all go to 224.0.0.22, which every IGMPv3 router listens to. MLDv2, RFC 3810 (June 2004), is the same design for IPv6, carried inside ICMPv6.

    Membership is soft state: it lasts only as long as hosts keep answering queries. The timers come from RFC 9776.

    TimerDefaultWhat it does
    Robustness Variable2How many lost packets the protocol tolerates: messages that matter are sent this many times
    Query Interval125 sTime between general queries from the querier
    Query Response Interval10 sThe longest a host may wait before answering a general query
    Group Membership Interval270 sHow long a router keeps a group alive with no reports
    GMI = Robustness × Query Interval + 2 × Query Response Interval = 2 × 125 + 2 × 10 = 270 s
    A host that crashes without sending a Leave keeps its group flowing for up to four and a half minutes. RFC 3376 used one Query Response Interval in this formula, giving 260 s; RFC 9776 changed it to two.

    Between the router and the hosts there is usually a switch, and a plain switch floods multicast frames out of every port, like broadcast. IGMP snooping fixes that: the switch reads the IGMP reports passing through it and forwards each group only to the ports where a report was heard, plus the port toward the router. RFC 4541 describes how switches should do it.

    Go deeper: the IGMPv3 report, record by record

    An IGMPv3 report carries any number of group records. Each record names a group, a record type and a list of sources. The six types say either what the host's state is (in reply to a query) or how it has just changed.

    TypeNameMeaning
    1MODE_IS_INCLUDECurrent state: I want G only from the listed sources
    2MODE_IS_EXCLUDECurrent state: I want G from all sources except those listed
    3CHANGE_TO_INCLUDE_MODEI have switched to INCLUDE; an empty list here means "I am leaving G"
    4CHANGE_TO_EXCLUDE_MODEI have switched to EXCLUDE; an empty list here is the old "join G from anyone"
    5ALLOW_NEW_SOURCESAdd these sources
    6BLOCK_OLD_SOURCESStop sending me these sources

    The router merges every host's records into one state per group per interface. If any host is in EXCLUDE mode, the interface is in EXCLUDE mode, because some host wants traffic from sources nobody has listed. The merge rules fill several pages of RFC 9776.

    The loop breaker

    Reverse-path forwarding

    A unicast router forwards a packet out of one interface, chosen by its destination. A multicast router may forward one packet out of many. That is the whole point, and also the danger: in any network with a loop, a router that copies a packet to all its neighbors will soon receive the copies back from them and copy those too. Without a rule, the copies multiply until links saturate.

    The rule is the reverse-path forwarding check, or RPF check. For each arriving multicast packet, the router looks up the packet's source address in its ordinary unicast routing table and finds the interface it would use to send a packet back to that source. That is the RPF interface. If the packet arrived on it, the router accepts and forwards it. If the packet arrived on any other interface, the router drops it.

    accept(packet) ⇔ arrival interface = RPF interface(packet.source)
    The RPF interface is wherever the unicast route back to the source points. Every router therefore accepts exactly one copy: the one that came along the shortest path from the source.

    Why does this stop loops? Every router's RPF interface points one step closer to the source along a shortest path, so following RPF interfaces from any router always ends at the source and never goes round in a circle. Together they form a tree rooted at the source: the reverse shortest-path tree. A packet is accepted only when it travels down that tree, and a packet that has gone round a loop is, by definition, not on the tree when it comes back, so it is dropped the first time it arrives somewhere off the tree.

    Notice what the check borrows. It never asks a multicast protocol where the source is; it uses whatever unicast table the router already has, filled by OSPF, IS-IS, BGP or static routes. That is the "protocol independent" in Protocol Independent Multicast. It also means a broken unicast table breaks multicast: if the route back to a source points somewhere the multicast traffic does not come from, every packet fails RPF and is silently dropped. "My stream reaches the router but goes no further" is very often an RPF failure.

    Go deeper: when the RPF table differs from the unicast table

    Sometimes the path you want multicast to arrive on is not the path unicast uses back to the source, for example when a separate link carries only video. Routers let you install routes used only for RPF: static multicast routes, or a separate address family learned through Multiprotocol BGP (the IPv4 multicast SAFI). The check stays the same; only the table it looks in changes. On a shared LAN where two routers could both forward the same stream onto it, PIM runs an Assert election so only one does, with the router holding the better route back to the source winning and the highest address breaking ties (RFC 7761).

    Instrument 2

    Flood a packet, check every copy

    Source S sits behind R1. Each router has run Dijkstra over the link costs shown and found its route back to S; the cobalt arrow on each router points out of its RPF interface. Press Send to flood one packet: every router that accepts a copy forwards it out of all its other links, round by round. Each copy is RPF-checked on arrival. Then switch the RPF check off and send again. Click or tap a link (or pick it from the list) to change its cost and see whose RPF interface moves.

    Round–
    Copies sent0
    Accepted0
    Dropped0

    Building trees

    PIM sparse mode and the rendezvous point

    Flooding with an RPF check delivers everything everywhere exactly once, and that was the first design: PIM dense mode (RFC 3973) floods each new source's traffic to every router, and routers with no interested receivers send a Prune back upstream. Prunes expire after a few minutes, and unless optional State Refresh messages keep them alive, the flood starts again. That is fine when most links have listeners. When listeners are sparse, which is almost always, it wastes bandwidth and fills every router with state for every source.

    PIM sparse mode, specified in RFC 7761 (March 2016), turns it around: nothing is sent anywhere until someone asks. Its problem is that receivers know a group but not who is sending to it. The answer is a meeting place, the rendezvous point or RP: one router that every router in the domain agrees is the root for a group. Sparse mode works in three phases.

    1. Receivers join the shared tree. When a host reports interest in G, its last-hop router (its designated router) sends a PIM Join for (*,G), read "star comma G", meaning "group G from any source", one hop toward the RP, using the RPF interface toward the RP's address. Each router on the way creates (*,G) state, records the interface the join came in on as an outgoing interface, and passes the join on, unless it already has (*,G) state, in which case the branch has reached the tree and it stops. The result is a tree rooted at the RP: the shared tree or rendezvous-point tree.
    2. The source registers. When a source starts sending, its first-hop router knows nothing about receivers. It wraps each packet in a unicast Register message and sends it straight to the RP, which unwraps it and sends it down the shared tree. Encapsulation is slow, so the RP sends an (S,G) Join toward the source, building a native path from S to the RP; once packets arrive that way, it sends the first-hop router a Register-Stop.
    3. Receivers switch to the shortest path. The path S → RP → receiver may be much longer than S → receiver. Once traffic from S arrives, a last-hop router may send its own (S,G) Join straight toward S, building the shortest-path tree. When packets arrive on that tree, it sends an (S,G,rpt) Prune up the shared tree, meaning "keep the shared tree for other sources, but stop sending me S on it". If no branch below the RP still wants S that way, the RP prunes its own (S,G) path toward the source.

    When to switch is a local policy: RFC 7761 leaves it to the implementation. Many routers switch on the first packet; some can be told never to switch. All this state is soft: PIM routers resend their joins every 60 seconds, and state that is not refreshed expires. Neighbors find each other with Hellos to 224.0.0.13 every 30 seconds, and all PIM messages travel as IP protocol 103.

    StateRead asIncoming interfaceBuilt by
    (*,G)Group G, any sourceRPF interface toward the RPJoins from receivers' routers
    (S,G)Group G, from source S onlyRPF interface toward SJoins from the RP or from routers switching to the shortest path
    (S,G,rpt)Source S on G's shared treeThe shared tree'sPrunes that remove S from parts of the shared tree
    Go deeper: how everyone agrees on the RP

    Every router must map each group to the same RP, or the trees never meet. There are three common ways. Static configuration: the same RP address typed into every router. The Bootstrap Router mechanism (RFC 5059): candidate RPs advertise themselves to an elected bootstrap router, which floods the list through the domain, and every router runs the same hash over the group address to choose among candidates, the highest hash winning and the highest address breaking ties (RFC 7761). And anycast RP (RFC 4610): several routers share one RP address, unicast routing sends each join to the nearest, and the RPs tell each other about their sources. The last one gives the RP redundancy without any multicast-specific failover.

    Instrument 3

    Build the tree, count the copies

    Pick which hosts join the group, choose the RP, then flip between the shared tree and the shortest-path tree. The builder computes each router's unicast routes with Dijkstra, sends the joins along the RPF paths, applies the (S,G,rpt) prunes, and then forwards one packet from S through the resulting state using PIM's rules, RPF check included. The table shows every router's state; the readout compares the copies multicast sends with what one unicast stream per receiver would cost.

    Multicast copies per packet–
    Unicast copies needed–
    Copies on S's link–
    Longest path (hops)–

    Solid cobalt links: copies forwarded by (S,G) state. Dashed amber: copies forwarded by (*,G) state on the shared tree. Thin dashed grey marked "pruned": a shared-tree branch that keeps (*,G) state but no longer carries S. "×2" marks a link that carries the same packet twice, once each way. In the (S,G) column, the outgoing list includes the (*,G) interfaces the router inherits.

    Router(*,G) in → out(S,G) in → outNotes
    The simpler model

    Skip the meeting: source-specific multicast

    Most of PIM sparse mode's machinery, the RP, registers, the switchover and the (S,G,rpt) prunes, exists to solve one problem: receivers do not know who the source is. For most real applications they do. A television channel has one encoder, a market-data feed has a known publisher, and a receiver can be told the source address along with the group in the channel guide or configuration.

    Source-specific multicast, RFC 4607 (August 2006), uses that. A receiver asks for a channel, the pair (S,G), with an IGMPv3 or MLDv2 INCLUDE report. Its router sends an (S,G) Join straight toward S, building the shortest-path tree from the start. There is no RP, no shared tree, no register and no switchover. Two different sources can use the same group number without colliding, because the channel is the pair. And an outsider cannot inject traffic into a channel by sending to G, because routers forward only what comes from S along the RPF path to S.

    SSM uses 232.0.0.0/8 in IPv4 and FF3x::/32 in IPv6. Routers apply SSM rules to those ranges: they never build (*,G) state there. The price is that every receiver's host stack and every last-hop router must speak IGMPv3 or MLDv2.

    PIM sparse mode (any-source)Source-specific multicast
    Receiver asks forG(S,G)
    Rendezvous pointRequired, agreed domain-wideNone
    TreesShared tree, then optional shortest-path treeShortest-path tree only
    Host protocolIGMPv2 or later, MLDv1 or laterIGMPv3, MLDv2
    Address rangeMost of 224/4 and FF00::/8232/8 and FF3x::/32
    In practice

    Where multicast lives, and where it never took off

    Multicast thrives inside networks run by one organization that controls every router and has a real one-to-many problem. Telecom operators deliver IPTV channels to set-top boxes with it. Stock exchanges publish market data as multicast feeds, because the alternative, sending each subscriber a separate copy, would put some subscribers microseconds behind others. Financial firms, broadcast studios moving uncompressed video, and data centers distributing operating-system images or keeping cluster software in step use it for the same reason. Routing protocols themselves use link-local groups every second, as the OSPF and PIM addresses above show.

    Across the public internet, multicast never became a general service. RFC 5110 (January 2008), an overview of inter-domain multicast, lays out why it is hard. Each network on the path has to run PIM, agree on RPs or share source information between domains, keep per-group and per-source state in its routers, and accept traffic whose volume it cannot easily bill for or control. A network that skips any of this breaks delivery for everyone behind it. Meanwhile replicated unicast from content delivery networks, with caches placed close to viewers, got cheap enough to carry video at internet scale. The experimental global multicast backbone of the 1990s, the MBone, was built as tunnels over networks that did not support multicast, which shows the gap from the start.

    In data-center overlays, where one virtual network may need to flood a frame to all its endpoints, the same choice appears again: an underlay running PIM, or replication by the edge device. That trade-off belongs to data-center fabrics.

    Go deeper: MSDP and BIER

    MSDP, the Multicast Source Discovery Protocol (RFC 3618, October 2003, Experimental), connects the RPs of different domains. When an RP learns of a new source through a Register, it sends a Source-Active message to its MSDP peers in other domains, which flood it on with an RPF check of their own. An RP that has receivers for that group can then join the source's tree across the boundary. MSDP is also how anycast RPs inside one domain have often learned of each other's sources.

    BIER, Bit Index Explicit Replication (encapsulation in RFC 8296, January 2018), removes per-group state from the middle of the network. The ingress router writes a bit string into the packet header with one bit for each egress router that should receive it. Each router looks up which neighbors lead to which bits, copies the packet once per neighbor and clears the bits the other copies will handle. Core routers need only unicast-style forwarding tables, however many groups exist, at the cost of a header whose size grows with the number of egress routers in a set.

    Cheat sheet

    Terms from this chapter

    Host group
    The set of receivers, possibly empty and always changing, named by one multicast address.
    IGMP / MLD
    The protocols hosts use to tell their local router which groups they want: IGMP for IPv4, MLD for IPv6.
    Querier
    The one router on a LAN that sends periodic IGMP or MLD queries to find out which groups still have listeners.
    IGMP snooping
    A switch reading IGMP messages so it can send each group only to the ports that asked for it.
    RPF check
    Accepting a multicast packet only if it arrived on the interface this router would use to reach the packet's source.
    RPF interface
    The interface the unicast routing table points to for a packet's source (or for the RP, on a shared tree).
    Rendezvous point (RP)
    The router that roots a group's shared tree in PIM sparse mode, where sources and receivers first meet.
    (*,G)
    Router state for group G from any source, on the shared tree rooted at the RP.
    (S,G)
    Router state for group G from source S only, on the shortest-path tree rooted at the source.
    Register
    A unicast message in which a source's first-hop router wraps multicast packets and sends them to the RP.
    Source-specific multicast (SSM)
    Multicast where receivers name both source and group, so trees are built straight to the source with no RP.
    Where this comes from

    Sources