SMCROUTE.CONF(5)

πŸ“¦
version 2.5.7 Β· 3 versions
, in debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– SMCROUTE.CONF πŸ’–

okay bestie, so this is smcroute.conf from the File Formats Manual β€” it's literally the config file format for smcrouted and we're gonna go through every single bit of it together 🫢


✨ NAME ✨

smcroute.conf β€” the config file format for smcrouted πŸ‘‘


🌸 DESCRIPTION 🌸

okay so first things first, plot twist: the file smcroute.conf is, strictly speaking, not critical to how smcrouted runs. like, some warnings might get logged, and as long as the daemon wasn't started with -N, it just enables VIFs for every interface it can find and then vibes, waiting for commands from smcroutectl(8). but like… as you can tell from that caveat, any non-trivial setup literally requires an smcroute.conf. no cap. πŸ’…

On most systems the configuration file(s) live in:

  • /etc/smcroute.conf β€” the traditional location, holding all the routes, group joins, and interfaces.
  • /etc/smcroute.d/*.conf β€” recently an include directive got added to smcroute.conf, which lets you include other files. by convention /etc/smcroute.d/ has been chosen as the default in the bundled example smcroute.conf. more on the include directive below, bestie.

In debug mode, smcrouted logs the success of parsing each line and setting up a route. there's also a basic syntax validator built-in, see smcrouted(8) for more info. πŸ”₯


πŸŽ€ SYNTAX πŸŽ€

this section spills the tea on the syntax of each of the available config file directives.

Comments start with β€œ#” and run to the end of line. See the β€œEXAMPLE” below. ⭐

  • phyint IFNAME [enable | disable] [mrdisc] [ttl-threshold TTL] β€” By default all interfaces on the system are enabled and possible to route between, provided they have the MULTICAST interface flag set. The phyint directive can be used to selectively enable, or disable, interfaces from being mapped to virtual interfaces (VIFs), which the multicast routing stack actually employs. VIFs are limited, most operating systems only have 32, so it is recommended to disable all interfaces by default, with smcrouted -N, and enable them one by one using this directive.
    • mrdisc is an IPv4 specific feature flag to enable Multicast Router Discovery protocol, RFC4286, announcement. This standard is supported by some switch (and router) manufacturers and may be used instead of having mgroup statements for all possible multicast groups you may want to forward.
    • ttl-threshold is a very useful setting to help implement "TTL scoping". I.e., the minimum TTL level a multicast stream must exceed for the kernel to consider it to be routed. The default value (1) means a TTL of 2 or higher is needed for a frame to be forwarded to the routing stack, otherwise it is considered link-local. See smcrouted(8) for more information on multicast scoping.
Note: all phyint directives must be read by smcrouted before any mgroup or mroute that refer to them! Hence, either place all phyint directives in the main smcroute.conf or, if /etc/smcroute.d/*.conf is used, first in a file named, 00-phyint.conf, or similar.
  • mgroup from IIF [source SOURCE[/LEN]] group GROUP[/LEN] β€” Join a multicast group, with optional prefix length, on a given inbound interface (IIF). The source address is optional, but if given a source specific (SSM) join is performed. Every /LEN is translated to as many sources and groups as specified. To attempt to overcome (configured) kernel limitations, smcrouted probes the amount of joins available per socket. When the socket has been exhausted, another one is opened. At most 2048 sockets are opened.
    • The purpose of joining groups is to use layer-2 signaling to inform switches, and other routers, to open up multicast traffic to your interfaces. Leaving a group is not supported from the configuration file, instead remove the mgroup, or trim its arguments, SIGHUP or smcrou​tectl reload your daemon.
Note: use of the mgroup command should be avoided if possible. Instead configure "router ports" or similar on the switches (bridges) on your LAN. This to have them direct all the multicast to your router, or direct select groups if they have such capabilities. Usually MAC multicast filters exist.
  • mroute from IIF [source SOURCE[/LEN]] group GROUP[/LEN] to OIF [OIF ...] β€” Add a multicast route for packets received on network interface IIF, originating from IP address SOURCE, and sent to the multicast group address GROUP, to the outbound network interface(s) OIF [OIF ...].
    • The interfaces provided as IIF and OIF can be any network interface name available in the system, as long as it has the MULTICAST flag set. Furthermore, the kernel usually only forwards traffic if the interface(s) have an IP address. These are limitations posed by the kernel, not smcrouted.
    • To add a (*,G) route, either leave SOURCE out completely or set it to 0.0.0.0, and if you want to specify a range, set GROUP/LEN, e.g. 225.0.0.0/24.
  • include PATH β€” Include another smcroute.conf file, or set of files. Matching is performed using glob(3), and matches are sorted alphabetically. By convention, the example smcroute.conf bundled with smcrouted includes /etc/smcroute.d/*.conf.

πŸ¦‹ EXAMPLE πŸ¦‹

smcrouted supports reading and setting up multicast routes from a config file. The default location is /etc/smcroute.conf, but this can be overridden using the -f FILE command line option.

The IIF and OIF arguments below are interface names, or interface wildcards of the form eth+, which matches eth0, eth10, etc. Wildcards are available for inbound interfaces. 🌈

#
# smcroute.conf example
#
# Syntax:
#   phyint IFNAME <enable|disable> [mrdisc] [ttl-threshold <1-255>]
#   mgroup from IIF [source ADDR[/LEN]] group GROUP[/LEN]
#   mroute from IIF [source ADDR[/LEN]] group GROUP[/LEN] to OIF [OIF ...]
#   include /path/to/*.conf

# Assuming smcrouted was started with the `-N` flag.  Enable interfaces
# required for inbound and outbound traffic.  TTL scoping is enabled on
# all interfaces, e.g., to use eth0 as n outbound interface (OIF), all
# multicast frames must have a TTL of 12 or greater when ingressing.
phyint eth0 enable ttl-threshold 11
phyint eth1 enable ttl-threshold 3
phyint eth2 enable ttl-threshold 5
phyint virbr0 enable ttl-threshold 5

# Instruct the kernel to join the multicast group 225.1.2.3 on interface
# eth0.  Then add an mroute of the same multicast stream, from the host
# 192.168.1.42 on interface eth0 and forward to eth1 and eth2.
mgroup from eth0                     group 225.1.2.3
mroute from eth0 source 192.168.1.42 group 225.1.2.3 to eth1 eth2

# Similarly, but using source-specific group join
mgroup from virbr0 source 192.168.123.110 group 225.1.2.4
mroute from virbr0 source 192.168.123.110 group 225.1.2.4 to eth0

# Allow multicast for group 225.3.2.1, from ANY source, ingressing on
# interface eth0 to be forwarded to eth1 and eth2.  When the kernel
# receives a frame from unknown multicast sender, it asks smcrouted who
# use this "template" to match against, if the ingressing interface and
# group matches, smcrouted installs an (S,G) route in the kernel MFC.
mgroup from eth0 group 225.3.2.1
mroute from eth0 group 225.3.2.1 to eth1 eth2

# The previous is an example of the (*,G) support.  It is also possible
# to specify a range of such rules.
mgroup from eth0 group 225.0.0.0/24
mroute from eth0 group 225.0.0.0/24 to eth1 eth2

# Include any snippet in /etc/smcroute.d/, but please remember that
# all phyint statements must be read first.
include /etc/smcroute.d/*.conf

😭 CAVEATS 😭

bestie listen up, this part matters. The source address is optional for both IPv4 and IPv6 multicast routes, this is called (*,G) routing. When omitted, smcrouted dynamically installs (S,G) routes, matching the group and inbound interface, to the kernel when it learns of new inbound multicast. This feature was inherited from mrouted(8), and may not work as intended in all use-cases. Also, depending on kernel and CPU load, account for the setup time to detect and install the route β€” expect at least one initial frame to be lost when using (*,G) rules. πŸ’€


πŸ’œ FILES πŸ’œ

  • /etc/smcroute.conf
  • /etc/smcroute.d/*.conf

πŸ‘‘ SEE ALSO πŸ‘‘

smcrouted(8), smcroute.conf(5)


🧚 AUTHORS 🧚

SMCRoute was originally created by Carsten Schill <carsten@cschill.de>. Initial IPv6 support by Todd Hayton <todd.hayton@gmail.com>. Initial FreeBSD support by Micha Lenk <micha@debian.org>.

SMCRoute is currently maintained by Joachim Wiberg <troglobit@gmail.com>, and Micha Lenk <micha@debian.org> at GitHub: https://github.com/troglobit/smcroute


and that's the whole page, no notes πŸ’… this was the Debian build, dated August 15, 2021 β€” slay, go configure your multicast routes bestie, you got this 🫢✨

πŸ“¦ where this page comes from