-
Notifications
You must be signed in to change notification settings - Fork 460
IPv4 Multicast
IPv4 Multicast is a BGP address family (AFI 1, SAFI 2) that enables BGP to carry multicast routing information for IPv4 networks. It allows BGP to signal multicast reachability (Multicast RPF - Reverse Path Forwarding) information across autonomous systems, supporting protocols like PIM (Protocol Independent Multicast) and MSDP (Multicast Source Discovery Protocol).
ExaBGP provides full IPv4 Multicast (SAFI 2) support, enabling applications to programmatically announce and receive IPv4 multicast routes for inter-domain multicast routing, content delivery networks, IPTV, and financial data distribution.
- What is IPv4 Multicast (SAFI 2)?
- Why Use BGP for Multicast?
- ExaBGP IPv4 Multicast Capabilities
- Key Concepts
- Configuration Examples
- API Examples
- Use Cases
- Common Errors and Solutions
- Important Considerations
- See Also
- References
IPv4 Multicast (SAFI 2) is a BGP Subsequent Address Family Identifier that enables BGP to carry multicast routing information. Unlike unicast routing (SAFI 1) which focuses on destination-based forwarding, multicast routing requires source-based tree construction and Reverse Path Forwarding (RPF) checks.
[Inter-Domain Multicast Architecture]
Multicast Source (192.0.2.10)
β
β Streams: 239.1.1.1
β
ββββΌβββ ββββββββ
β AS β BGP Multicast β AS β
β65001ββββββββββββββββββββββββββββββββΊβ65002 β
β β (SAFI 2 Routes) β β
βββββββ ββββ¬ββββ
β β
β PIM Join β PIM Join
β β
Receivers Receivers
(239.1.1.1) (239.1.1.1)
Process:
- BGP Multicast Route Advertisement: ASes advertise reachable multicast sources via BGP SAFI 2
- RPF Information: BGP multicast routes provide RPF information for PIM
- PIM Tree Building: PIM uses BGP routes to determine upstream direction toward source
- Traffic Flow: Multicast traffic flows from source to receivers via PIM-constructed tree
- Inter-AS Coordination: BGP coordinates multicast routing across AS boundaries
Key Difference from Unicast:
- Unicast (SAFI 1): "How to reach destination 10.0.0.0/8?"
- Multicast (SAFI 2): "Which path leads back to source 192.0.2.10?" (for RPF check)
Without BGP Multicast:
- PIM cannot determine correct RPF path across AS boundaries
- Multicast routing limited to single AS
- Manual static mroute configuration required
- No inter-domain multicast service coordination
With BGP Multicast (SAFI 2):
- β Automated inter-AS multicast routing
- β RPF information distribution via BGP
- β Policy-based multicast routing (BGP attributes)
- β Scalable multicast across multiple ASes
- β Separate unicast and multicast topologies (if needed)
- IPTV and Video Delivery: Inter-AS video multicast distribution
- Financial Data Distribution: Market data feeds across multiple sites
- Content Delivery Networks (CDN): Multicast content distribution
- Service Provider Multicast: Carrier-grade multicast services
- Data Center Replication: Multicast-based data replication across DCs
ExaBGP provides full IPv4 Multicast (AFI 1, SAFI 2) support:
β IPv4 Multicast Routes (SAFI 2):
- Announce IPv4 prefixes with multicast SAFI
- Receive multicast routes from BGP peers
- Next-hop handling for multicast RPF
β Standard BGP Attributes:
- AS-PATH, MED, LOCAL_PREF, COMMUNITIES
- All standard BGP attributes apply to multicast routes
- Policy-based multicast route control
β Multicast-Specific Handling:
- Separate from unicast routing table
- Independent next-hop for multicast vs unicast
- RPF-aware route signaling
β Integration with PIM:
- Provides RPF information for PIM
- Coordinates inter-AS multicast tree building
- Supports both ASM (Any-Source Multicast) and SSM (Source-Specific Multicast)
Implementation:
-
src/exabgp/bgp/message/update/nlri/inet.py(IPv4 NLRI handling) -
src/exabgp/protocol/family.py(SAFI.multicast definition)
-
RFC 4760: Multiprotocol Extensions for BGP-4 - Fully Implemented
- SAFI 2 (Multicast) support
- MP_REACH_NLRI and MP_UNREACH_NLRI for multicast routes
-
RFC 2858: Multiprotocol Extensions for BGP-4 (predecessor to RFC 4760) - Fully Implemented
| Feature | Unicast (SAFI 1) | Multicast (SAFI 2) |
|---|---|---|
| Purpose | Destination-based forwarding | Source-based tree building |
| Routing Question | "How to reach destination X?" | "Which path leads to source S?" |
| Forwarding | Longest prefix match | RPF check + multicast tree |
| Next-Hop Usage | Forward toward destination | RPF toward source |
| Traffic Pattern | One sender β one receiver | One sender β many receivers |
| Protocols | Standard IP routing | PIM, IGMP, MSDP |
RPF Check is the fundamental mechanism preventing multicast loops.
How RPF Works:
- Router receives multicast packet from source S on interface I
- Router checks: "If I were to send a packet to S, would it go out interface I?"
- If YES: RPF check passes β forward multicast packet
- If NO: RPF check fails β drop multicast packet (potential loop)
BGP Multicast's Role in RPF:
Without BGP Multicast:
- Router uses unicast routing table for RPF check
- Problem: Unicast and multicast topologies may differ
With BGP Multicast (SAFI 2):
- Router uses multicast routing table for RPF check
- Separate multicast topology possible
- Inter-AS RPF coordination via BGP
Example:
Source: 192.0.2.10 (in AS 65001)
Receiver: 10.1.1.50 (in AS 65002)
BGP Multicast Route Advertisement (AS 65001 β AS 65002):
Prefix: 192.0.2.0/24
SAFI: 2 (Multicast)
Next-Hop: 203.0.113.1 (border router)
AS 65002 uses this route for RPF:
- Multicast packet from 192.0.2.10 arrives at 203.0.113.1
- RPF check: "Route to 192.0.2.0/24 points to 203.0.113.1"
- RPF PASS β forward packet to receivers
MBGP refers to BGP's ability to carry multiple address families simultaneously (RFC 4760).
Key Benefit: Independent unicast and multicast topologies.
Example Scenario:
Unicast Routing (SAFI 1):
AS 65001 β AS 65002 β AS 65003
(shortest AS-PATH)
Multicast Routing (SAFI 2):
AS 65001 β AS 65004 β AS 65003
(lower latency path for multicast traffic)
ExaBGP Configuration:
neighbor 192.0.2.1 {
family {
ipv4 unicast; # SAFI 1
ipv4 multicast; # SAFI 2
}
}PIM (Protocol Independent Multicast) is the multicast routing protocol. BGP provides RPF information to PIM.
Integration Flow:
1. BGP advertises multicast routes (SAFI 2)
2. Router installs routes in multicast RIB (mRIB)
3. PIM uses mRIB for RPF checks
4. PIM builds multicast distribution tree
5. Multicast traffic flows along PIM tree
PIM Modes:
- ASM (Any-Source Multicast): PIM-SM, uses RP (Rendezvous Point)
- SSM (Source-Specific Multicast): PIM-SSM, no RP required
Both modes use BGP multicast routes for inter-AS RPF.
# /etc/exabgp/multicast.conf
neighbor 192.0.2.1 {
router-id 192.0.2.2;
local-address 192.0.2.2;
local-as 65001;
peer-as 65000;
# Enable IPv4 Multicast address family
family {
ipv4 multicast; # SAFI 2
}
# API process for dynamic multicast route announcements
api {
processes [ multicast-controller ];
}
}
process multicast-controller {
run python3 /etc/exabgp/multicast-announce.py;
encoder text;
}# /etc/exabgp/dual-topology.conf
neighbor 192.0.2.1 {
router-id 192.0.2.2;
local-address 192.0.2.2;
local-as 65001;
peer-as 65000;
# Enable both unicast and multicast
family {
ipv4 unicast; # SAFI 1 (unicast routing)
ipv4 multicast; # SAFI 2 (multicast RPF)
}
api {
processes [ route-controller ];
}
}
process route-controller {
run python3 /etc/exabgp/announce-routes.py;
encoder text;
}Basic multicast route announcement:
#!/usr/bin/env python3
# /etc/exabgp/multicast-announce.py
import sys
import time
def announce_multicast_route(prefix, nexthop="self", med=None, local_pref=None):
"""Announce IPv4 multicast route for RPF"""
cmd = f"announce route {prefix} next-hop {nexthop}"
if med:
cmd += f" med {med}"
if local_pref:
cmd += f" local-preference {local_pref}"
print(cmd)
sys.stdout.flush()
def withdraw_multicast_route(prefix, nexthop="self"):
"""Withdraw IPv4 multicast route"""
print(f"withdraw route {prefix} next-hop {nexthop}")
sys.stdout.flush()
# Announce multicast route for source network
announce_multicast_route(
prefix="192.0.2.0/24", # Network containing multicast sources
nexthop="self",
local_pref=200 # Prefer this path for multicast RPF
)
# Keep process running
while True:
time.sleep(60)Announce multicast route:
# Basic announcement
print("announce route 192.0.2.0/24 next-hop self")
sys.stdout.flush()
# With BGP attributes for policy
print("announce route 192.0.2.0/24 "
"next-hop self "
"local-preference 200 "
"med 10 "
"community [ 65001:100 ]")
sys.stdout.flush()Withdraw multicast route:
print("withdraw route 192.0.2.0/24 next-hop self")
sys.stdout.flush()#!/usr/bin/env python3
# /etc/exabgp/multicast-health-check.py
import sys
import time
import subprocess
def check_multicast_source_reachable(source_ip):
"""Check if multicast source is reachable"""
try:
result = subprocess.run(
['ping', '-c', '1', '-W', '1', source_ip],
capture_output=True,
timeout=2
)
return result.returncode == 0
except:
return False
def announce_multicast(prefix):
print(f"announce route {prefix} next-hop self local-preference 200")
sys.stdout.flush()
def withdraw_multicast(prefix):
print(f"withdraw route {prefix} next-hop self")
sys.stdout.flush()
prefix = "192.0.2.0/24"
source_ip = "192.0.2.10"
announced = False
while True:
reachable = check_multicast_source_reachable(source_ip)
if reachable and not announced:
# Source reachable, announce multicast route
announce_multicast(prefix)
announced = True
print(f"# Multicast source {source_ip} reachable, route announced", file=sys.stderr)
elif not reachable and announced:
# Source unreachable, withdraw multicast route
withdraw_multicast(prefix)
announced = False
print(f"# Multicast source {source_ip} unreachable, route withdrawn", file=sys.stderr)
time.sleep(5) # Check every 5 secondsReceived multicast route (JSON format from ExaBGP):
{
"exabgp": "5.0",
"type": "update",
"neighbor": {
"address": {"local": "192.0.2.2", "peer": "192.0.2.1"},
"message": {
"update": {
"announce": {
"ipv4 multicast": {
"192.0.2.0/24": {
"attributes": {
"next-hop": "203.0.113.1",
"local-preference": 200,
"med": 10,
"as-path": [65000],
"community": ["65001:100"]
}
}
}
}
}
}
}
}Scenario: ISP delivering IPTV to customers across multiple ASes or regions.
How IPv4 Multicast Helps:
- Video streams sent once, replicated at routers
- BGP multicast routes coordinate inter-AS IPTV delivery
- PIM uses BGP routes for RPF checks
- Efficient bandwidth usage (no per-subscriber streams)
ExaBGP Role:
- Announce source networks containing IPTV encoders
- Policy-based multicast routing (prefer low-latency paths)
- Health-check-based announcements (withdraw if encoder fails)
- Integration with video head-end systems
Example:
# Announce IPTV source network
print("announce route 203.0.113.0/24 " # Encoder network
"next-hop self "
"local-preference 200 "
"community [ 65001:IPTV ]")Scenario: Stock exchanges distributing market data to brokers and traders.
How IPv4 Multicast Helps:
- Real-time market data (quotes, trades) multicast to all subscribers
- Low-latency distribution (multicast avoids per-client TCP overhead)
- BGP multicast for inter-site distribution
- Efficient bandwidth usage
ExaBGP Role:
- Announce exchange data center networks
- Failover between primary/backup exchanges
- Traffic engineering for lowest latency
- Integration with market data platforms
Example:
# Primary exchange
print("announce route 10.1.0.0/16 "
"next-hop self "
"local-preference 300 " # Primary
"community [ 65001:EXCHANGE-PRIMARY ]")
# Backup exchange (lower preference)
print("announce route 10.2.0.0/16 "
"next-hop self "
"local-preference 100 " # Backup
"community [ 65001:EXCHANGE-BACKUP ]")Scenario: CDN distributing live events (sports, concerts) via multicast.
How IPv4 Multicast Helps:
- Efficient live event distribution to edge caches
- Multicast from origin to all CDN nodes
- BGP multicast for inter-PoP coordination
- Reduced origin bandwidth
ExaBGP Role:
- Announce origin server networks
- Dynamic route updates during live events
- Failover between origin sites
- Policy-based path selection
Scenario: Database replication or distributed cache updates via multicast.
How IPv4 Multicast Helps:
- Efficient data replication (one send, many receivers)
- BGP multicast for inter-DC coordination
- Lower latency than TCP-based replication
- Reduced network bandwidth
ExaBGP Role:
- Announce data center source networks
- Health-based route management
- Integration with orchestration systems
- Policy-based multicast tree optimization
Scenario: Enterprise requiring multicast connectivity across service provider WAN.
How IPv4 Multicast Helps:
- Multicast across VPN (multicast VPN/MVPN)
- BGP multicast with VPN labels (MVPN via SAFI 129)
- Customer multicast isolation
- Inter-AS MVPN support
ExaBGP Role:
- Announce customer multicast routes
- Integration with MVPN infrastructure
- Policy-based VPN route distribution
Cause: BGP session doesn't have ipv4 multicast family configured.
Solution: Enable multicast address family on both peers.
ExaBGP:
neighbor 192.0.2.1 {
family {
ipv4 multicast; # Enable SAFI 2
}
}Cisco IOS-XR:
router bgp 65000
neighbor 192.0.2.2
address-family ipv4 multicast β Enable multicast
!
!
!
Juniper Junos:
protocols {
bgp {
group exabgp {
family inet {
multicast; β Enable multicast
}
}
}
}
Cause: PIM router not using multicast RIB (mRIB) for RPF checks.
Solution: Ensure PIM is configured to use multicast BGP routes for RPF.
Cisco IOS-XR:
router pim
address-family ipv4
rpf topology route-policy mcast-rpf β Use multicast RIB
!
!
Juniper Junos:
protocols {
pim {
rib-group inet multicast-rib; β Use multicast RIB
}
}
Cause: Separate multicast topology with different next-hops than unicast.
Solution: This is expected with separate unicast/multicast topologies. Ensure PIM uses multicast RIB for RPF.
Verify:
# Cisco IOS-XR
show mrib route 192.0.2.10 # Check multicast RIB
# Juniper Junos
show multicast rpf 192.0.2.10 # Check RPF informationCause: ExaBGP does NOT forward multicast traffic. It only provides BGP signaling.
Solution: ExaBGP provides RPF information via BGP. The router must:
- Run PIM (Protocol Independent Multicast)
- Have IGMP enabled on receiver interfaces
- Use BGP multicast routes in mRIB for RPF
- Have multicast forwarding enabled in kernel
Remember: ExaBGP announces routes for RPF but does NOT:
- Forward multicast packets
- Run PIM
- Handle IGMP
- Install multicast forwarding entries (mfib)
Cause: BGP policy filtering multicast routes.
Solution: Check import policies and BGP attributes.
Cisco IOS-XR:
router bgp 65000
neighbor 192.0.2.2
address-family ipv4 multicast
route-policy mcast-import in β Check this policy
!
!
!
- Forward multicast packets
- Run PIM (Protocol Independent Multicast)
- Handle IGMP (Internet Group Management Protocol)
- Install multicast forwarding entries (mfib)
- Perform RPF checks
What ExaBGP DOES:
- β Send/receive IPv4 multicast routes via BGP (SAFI 2)
- β Provide RPF information for PIM
- β Coordinate inter-AS multicast routing via BGP signaling
- β Support policy-based multicast route control
External Infrastructure Required:
- Multicast-capable routers: Cisco, Juniper, Arista with PIM support
- PIM configuration: PIM-SM or PIM-SSM must be configured
- IGMP: Receivers must send IGMP joins
- Multicast forwarding: Kernel multicast forwarding must be enabled
Typical Architecture:
[Your Application]
β
βββ [ExaBGP] βββ BGP Multicast ββββ [Routers]
β (RPF Signaling) β
β ββ PIM (tree building)
β ββ IGMP (receiver joins)
β ββ Multicast Forwarding
β
[Multicast Sources] βββββββββββββββ [Routers] βββ [Receivers]
(Traffic Flow) (PIM Tree)
Same Topology (Common):
- Multicast uses same paths as unicast
- Simpler configuration
- Single BGP session carries both SAFI 1 and SAFI 2
Separate Topology (Advanced):
- Multicast uses different paths than unicast
- Optimize for multicast traffic characteristics (bandwidth, latency)
- Requires careful RPF configuration
ExaBGP Configuration:
# Same topology
family {
ipv4 unicast;
ipv4 multicast;
}
# Separate topology (different neighbors or attributes)
neighbor 192.0.2.1 { # Unicast peer
family { ipv4 unicast; }
}
neighbor 203.0.113.1 { # Multicast peer (different path)
family { ipv4 multicast; }
}RPF is mandatory for multicast to prevent loops.
Why RPF is critical:
- Multicast doesn't use TTL-based loop prevention (like unicast)
- Without RPF, multicast packets would loop indefinitely
- BGP multicast routes provide RPF information
Best Practice:
- Ensure consistent RPF paths
- Monitor RPF failures
- Use uRPF (Unicast Reverse Path Forwarding) for security
- Route Scale: ExaBGP handles thousands of multicast routes
- BGP Convergence: Typically 1-5 seconds for route updates
- RPF Impact: RPF check adds minimal latency (microseconds)
- Multicast Forwarding: Line-rate forwarding (hardware-dependent)
Best Practices:
- Aggregate multicast source networks where possible
- Use route policies to control multicast route distribution
- Monitor PIM neighbor adjacencies
- Use SSM (Source-Specific Multicast) for better scalability
- BGP Authentication: Use MD5 or TCP-AO for BGP sessions
- Multicast Access Control: Filter multicast sources and groups
- RPF Strict Mode: Drop packets failing RPF check
- Rate Limiting: Limit multicast traffic to prevent abuse
- IPv6 Multicast - IPv6 multicast address family
- Text API Reference - API commands for multicast
- JSON API Reference - JSON message format
- Configuration Syntax - Family configuration
- IPv4 Unicast - IPv4 unicast routing
- L3VPN - Multicast VPN (MVPN) via SAFI 129
- Content Delivery - CDN multicast use cases
- Financial Services - Market data distribution
- Debugging - Troubleshooting multicast issues
- Monitoring - Monitoring multicast routes
- First BGP Session - Basic BGP setup
- Quick Start - 5-minute tutorial
-
RFC 4760: Multiprotocol Extensions for BGP-4
- SAFI 2 (Multicast) definition
- MP_REACH_NLRI and MP_UNREACH_NLRI
- https://datatracker.ietf.org/doc/html/rfc4760
-
RFC 2858: Multiprotocol Extensions for BGP-4
- Original multiprotocol BGP specification
- Predecessor to RFC 4760
- https://datatracker.ietf.org/doc/html/rfc2858
-
RFC 4271: A Border Gateway Protocol 4 (BGP-4)
- Core BGP protocol
- https://datatracker.ietf.org/doc/html/rfc4271
-
RFC 7761: Protocol Independent Multicast - Sparse Mode (PIM-SM)
- PIM protocol using BGP for RPF
- https://datatracker.ietf.org/doc/html/rfc7761
-
RFC 4607: Source-Specific Multicast for IP
- SSM model using BGP for RPF
- https://datatracker.ietf.org/doc/html/rfc4607
- ExaBGP GitHub: https://github.com/Exa-Networks/exabgp
- RFC Implementation: RFC-Information.md
-
Source Code:
src/exabgp/protocol/family.py(SAFI.multicast definition)
- Cisco Multicast Configuration: PIM and BGP multicast integration
- Juniper Multicast Routing: Junos multicast and MBGP configuration
- Arista Multicast: EOS multicast routing
- IP Multicast, Volume I (Josh Loveless, Ray Blair) - Comprehensive multicast guide
- Developing IP Multicast Networks (Beau Williamson) - Multicast design patterns
π» Ghost written by Claude (Anthropic AI)
π Home
π Getting Started
π§ API
π‘οΈ Use Cases
π Address Families
βοΈ Configuration
π Operations
π Reference
- Architecture
- BGP State Machine
- Communities (RFC)
- Extended Communities
- BGP Ecosystem
- Capabilities (AFI/SAFI)
- RFC Support
π Migration
π Community
π External
- GitHub Repo β
- Slack β
- Issues β
π» Ghost written by Claude (Anthropic AI)