Skip to content

IPv4 Multicast

Thomas Mangin edited this page Nov 15, 2025 · 5 revisions

IPv4 Multicast Address Family

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.

Table of Contents


What is IPv4 Multicast (SAFI 2)?

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.

How BGP Multicast Works

[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:

  1. BGP Multicast Route Advertisement: ASes advertise reachable multicast sources via BGP SAFI 2
  2. RPF Information: BGP multicast routes provide RPF information for PIM
  3. PIM Tree Building: PIM uses BGP routes to determine upstream direction toward source
  4. Traffic Flow: Multicast traffic flows from source to receivers via PIM-constructed tree
  5. 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)

Why Use BGP for Multicast?

Problems BGP Multicast Solves

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)

Common Use Cases

  1. IPTV and Video Delivery: Inter-AS video multicast distribution
  2. Financial Data Distribution: Market data feeds across multiple sites
  3. Content Delivery Networks (CDN): Multicast content distribution
  4. Service Provider Multicast: Carrier-grade multicast services
  5. Data Center Replication: Multicast-based data replication across DCs

ExaBGP IPv4 Multicast Capabilities

ExaBGP provides full IPv4 Multicast (AFI 1, SAFI 2) support:

Supported Features

βœ… 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 Support

  • 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


Key Concepts

Multicast vs Unicast

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 (Reverse Path Forwarding)

RPF Check is the fundamental mechanism preventing multicast loops.

How RPF Works:

  1. Router receives multicast packet from source S on interface I
  2. Router checks: "If I were to send a packet to S, would it go out interface I?"
  3. If YES: RPF check passes β†’ forward multicast packet
  4. 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 (Multiprotocol BGP)

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 and BGP Integration

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.


Configuration Examples

Basic IPv4 Multicast Configuration

# /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;
}

Dual Unicast and Multicast Configuration

# /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;
}

API Examples

Announce IPv4 Multicast Route (Text API)

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)

Text API Format Examples

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()

Conditional Announcement Based on Health Check

#!/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 seconds

JSON API Format

Received 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"]
              }
            }
          }
        }
      }
    }
  }
}

Use Cases

1. IPTV Service Provider Network

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 ]")

2. Financial Market Data Distribution

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 ]")

3. Content Delivery Network (CDN)

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

4. Data Center Multicast Replication

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

5. Service Provider Multicast VPN

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

Common Errors and Solutions

Error: "IPv4 Multicast family not enabled"

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
            }
        }
    }
}

Error: "Multicast routes announced but RPF checks failing"

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
    }
}

Error: "Multicast and unicast next-hops differ, RPF confused"

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 information

Error: "Routes announced but multicast traffic not forwarding"

Cause: 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)

Error: "Multicast route not imported"

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
  !
 !
!

Important Considerations

ExaBGP Does Not Manipulate RIB/FIB

⚠️ CRITICAL: ExaBGP is a BGP protocol engine. It does NOT:

  • 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)

Multicast vs Unicast Topology

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 and Loop Prevention

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

Performance Considerations

  • 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

Security Considerations

  • 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

See Also

ExaBGP Documentation

Related Address Families

Use Cases

Operations

Getting Started


References

RFCs and Standards

ExaBGP Resources

Vendor Documentation

  • Cisco Multicast Configuration: PIM and BGP multicast integration
  • Juniper Multicast Routing: Junos multicast and MBGP configuration
  • Arista Multicast: EOS multicast routing

Books and Articles

  • 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)

Clone this wiki locally