← Multicast & market data

Multicast protocol fundamentals (addressing, IGMP, snooping, PIM, sockets)

Merged on 2026-10-03 from the Mac session’s research note 2026-10-03-multicast-quant/01-multicast-fundamentals.md (AI-written, Chinese), translated and condensed.

Verification status. ✅ = checked against the source named. ❌ / ⚠️ = the Mac note was wrong or imprecise and is corrected here (also logged in the group verification log). Everything else is Unverified. It reads as standard textbook material, but nobody has checked it line by line. The failure stories (no querier, RPF, SPT switchover) are in 03 and are not repeated here.

Why it matters for trading

Delivery models

Model Who gets the packet One-to-many cost Typical use
Unicast One receiver N receivers = N copies from the sender Client/server
Broadcast Every host in the L2 domain Stops at the router; everyone must process it ARP, DHCP discover
Multicast Hosts that joined the group Sender sends once; the network copies at branch points, so each link carries a packet once IPTV, market data, conferencing
Anycast The nearest of several nodes (by routing metric) One-to-one, but the target varies DNS root servers, CDN edges

The model comes from RFC 1112 (Host Extensions for IP Multicasting, August 1989 ✅; the Mac note said 1986, which is the date of its predecessor RFC 988). Three ideas:

  1. The source sends once to a group address and does not track receivers.
  2. The network replicates packets along a distribution tree.
  3. It is receiver-driven: hosts join with IGMP, and the tree grows from the last-hop routers.

The cost: multicast runs over UDP, so there is no reliability, ordering or congestion control. Applications add those (see “Reliable multicast” below and 05).

Addresses

IPv4: 224.0.0.0/4 (old class D)

Block Name Notes
224.0.0.0/24 Local Network Control Never forwarded off the subnet. 224.0.0.1 all hosts, .2 all routers, .5/.6 OSPF, .9 RIPv2, .22 IGMPv3 reports, .251 mDNS, .252 LLMNR
224.0.1.0/24 Internetwork Control Routable control traffic; 224.0.1.1 = NTP ✅ IANA
224.2.0.0/16 SDP/SAP block Old MBone session announcements
232.0.0.0/8 SSM Source-Specific Multicast ✅ IANA (RFC 4607)
233.0.0.0–233.251.255.255 GLOP Static per-AS allocation (16-bit ASN in the middle octets) ✅ IANA (RFC 3180). ⚠️ Not all of 233/8 as the Mac note said: 233.252.0.0/24 is MCAST-TEST-NET
234.0.0.0/8 Unicast-prefix-based ✅ IANA (RFC 6034)
239.0.0.0/8 Administratively scoped (organization-local) ✅ IANA (RFC 2365). The private space, like RFC 1918 for unicast. 239.255.0.0/16 = local scope, 239.192.0.0/14 = organization-local scope

Practice: plan internal market-data groups inside 239/8 (for example by site / asset class / service), not in low 224.x, and avoid overlap between sites.

Source: IANA IPv4 Multicast Address Space Registry, https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml (checked 2026-10-03).

IPv6: ff00::/8

Multicast MAC addresses and the 32:1 overlap

IGMP: hosts and the first-hop router

Version RFC What it adds
IGMPv1 RFC 1112 (1989) Query and Report. No Leave: membership just times out
IGMPv2 RFC 2236 (1997) Leave Group (sent to 224.0.0.2), Group-Specific Query, Max Response Time, querier election (lowest IP wins)
IGMPv3 RFC 3376 (2002) Source filtering: INCLUDE (only from S) or EXCLUDE (all but S). Reports go to 224.0.0.22. RFC 4604 covers its use for SSM

How it works:

ASM vs SSM

Layer 2: keeping multicast from flooding

Layer 3: the PIM family

PIM is “protocol independent” because it uses whatever unicast routing table exists (OSPF, IS-IS, BGP) for its RPF check.

Reliable multicast (overview)

Limits and operations

Sockets and Linux tools

struct ip_mreq mreq;
mreq.imr_multiaddr.s_addr = inet_addr("239.1.1.5");   /* group */
mreq.imr_interface.s_addr = inet_addr("10.0.0.5");    /* local NIC IP; INADDR_ANY lets the kernel pick */
int on = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);       /* before bind() */
/* bind() to the group port, then join: */
setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof mreq);
/* sender side */
setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &ifaddr, sizeof ifaddr);
unsigned char ttl = 4;    setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof ttl);   /* default 1 */
unsigned char loop = 0;   setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof loop); /* default 1 */
Option Default Notes
IP_ADD_MEMBERSHIP / IP_DROP_MEMBERSHIP — Join or leave. On multi-NIC hosts name the interface; with INADDR_ANY the kernel may join on the wrong NIC (a classic “joined but no data”)
SO_REUSEADDR off Several sockets or processes on the same group port; set it before bind()
SO_REUSEPORT off ❌ The Mac note said Linux load-balances multicast across SO_REUSEPORT sockets. It does not: every matching socket gets its own copy (“Multicasts and broadcasts go to each listener”, __udp4_lib_mcast_deliver in Linux net/ipv4/udp.c ✅). Hash load-balancing applies to unicast
IP_MULTICAST_TTL 1 1 means the traffic never leaves the subnet; raise it when the feed crosses routers
IP_MULTICAST_LOOP 1 The sending host also receives its own packets; feed publishers usually turn it off
IP_MULTICAST_IF — Choose the sending NIC; needed on multi-NIC hosts
SO_RCVBUF OS default Raise it (and net.core.rmem_max) for bursts, or the socket queue overflows and drops

IPv6 equivalents: IPV6_JOIN_GROUP (struct ipv6_mreq), IPV6_MULTICAST_HOPS, IPV6_MULTICAST_LOOP, IPV6_MULTICAST_IF. Man page: ip(7).

Linux tools:

References

Source: knowledge base note multicast/04-protocol-fundamentals.md — own-words notes with sources, projected at build time.