Skip to content

Multicast Routing

Amit Cohen edited this page Jun 15, 2021 · 6 revisions
Table of Contents
  1. Multicast Routing In Linux Kernel
  2. Multicast Routing With Spectrum Hardware
  3. Dynamic Routing
  4. Further Resources

Multicast Routing In Linux Kernel

Multicast routing configuration in Linux is done via the mroute socket, similarly to the BSD multicast routing API. Currently, there is no netlink interface nor standard command line interface for creating new Multicast Forwarding Cache (MFC) entries, and users who are interested in adding static MFC entries (other than dynamic entires inserted by a multicast routing daemon) have to use the mroute interface directly.

Using the mroute socket, a user can add MFC entries, configure interfaces to be multicast forwarding and get multicast notifications from the kernel. Multicast router daemons use this interface to manipulate the kernel routing table.

To list the current MFC entries in the kernel, the ip tool can be used:

$ ip mroute
(0.0.0.0, 239.255.0.1)           Iif: sw1p7      Oifs: sw1p7 t_br0 sw1p4  State: resolved offload
(192.168.1.1, 239.255.0.1)       Iif: sw1p7      Oifs: sw1p6 sw1p4 sw1p2  State: resolved offload

For IPv6, this can be done in a similar manner by passing the -6 flag:

$ ip -6 mroute
(fe00:8000::1, ff05:0:dead:beef::) Iif: enp3s0np2  Oifs: enp3s0np4  State: resolved offload

Multicast Routing With Spectrum Hardware

As of Linux 4.15, the mlxsw driver supports offloading of L3 IPv4 multicast routes to the Spectrum ASIC. As of Linux 4.17, it supports the same for L3 IPv6 multicast routes. In a similar fashion to unicast case, the ip tool indicates whether an MFC entry is currently offloaded or not using the offload keyword.

If a failure is encountered (for example, due to lack of resources), the route will be marked with the flag "rt_offload_failed". It is also possible to get notifications to user-space in such cases.

Note: mlxsw has a hard limit of at most 6992 offloaded MDB entries.

Dynamic Routing

There are several daemons that implement specific multicast routing protocols. Any daemon that uses the kernel IPv4 multicast routing mechanism can be used with the mlxsw driver, for example:

  • pimd – a daemon implementing the PIM-SM protocol
  • FRRouting (FRR) – IP routing protocol suite for Linux and Unix platforms which includes, among others, a daemon for the PIM-SM protocol
  • mrouted – an implementation of the DVMRP protocol for Linux & BSD

Further Resources

  1. Multicast Routing Code in the Linux Kernel
  2. freeBSD multicast API man page
  3. LNST - The Linux Network Stack Test (LNST) has a Python module for the mroute API.
Clone this wiki locally