smcrouted configuration file format
is, strictly speaking,
not critical to the operation of
Some warnings may be logged, and provided the daemon is
, it enables VIFs for all interfaces it
can find and then waits for commands from
As you can tell from that caveat, any non-trivial setup requires an
On most systems the configuration file(s) are available in:
- The traditional location, with all routes, group joins, and
- Recently an
include directive was added
smcroute.conf, which allows for
including other files. By convention
/etc/smcrotue.d/ has been selected as
the default in the bundled example
smcroute.conf. See more about the
include directive below.
In debug mode,
logs the success of
parsing each line and setting up a route. There is also a basic syntax
validator built-in, see
This section details the syntax of each of the available configuration file
Comments start with “#” and run to the end of line. See the
- 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, it is recommended
to disable all interfaces by default, with
’, 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
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.
for more information on multicast scoping.
phyint directives must be read by
smcrouted before any
mroute that refer to them! Hence,
either place all
phyint directives in
smcroute.conf or, if
/etc/smcroute.d/*.conf is used, first
in a file named, 00-phyint.conf, or
- 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
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
smcroutectl 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.
- Add a multicast route for packets received on network interface
IIF, originating from IP address
SOURCE, and sent to the multicast group
GROUP, to the outbound network
The interfaces provided as
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
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.
- Include another
smcroute.conf file, or
set of files. Matching is performed using
matches are sorted alphabetically. By convention, the example
smcroute.conf bundled with
supports reading and setting up
multicast routes from a config file. The default location is
, but this can be
overridden using the
command line option.
arguments below are interface names, or
interface wildcards of the form eth+
, etc. Wildcards are available for
# smcroute.conf example
# 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 188.8.131.52 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 184.108.40.206
mroute from eth0 source 192.168.1.42 group 220.127.116.11 to eth1 eth2
# Similarly, but using source-specific group join
mgroup from virbr0 source 192.168.123.110 group 18.104.22.168
mroute from virbr0 source 192.168.123.110 group 22.214.171.124 to eth0
# Allow multicast for group 126.96.36.199, 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 188.8.131.52
mroute from eth0 group 184.108.40.206 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 220.127.116.11/24
mroute from eth0 group 18.104.22.168/24 to eth1 eth2
# Include any snippet in /etc/smcroute.d/, but please remember that
# all phyint statements must be read first.
The source address is optional for both IPv4 and IPv6 multicast routes, this is
called (*,G) routing. When omitted,
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
, 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.
SMCRoute was originally created by Carsten
Initial IPv6 support by Todd Hayton
Initial FreeBSD support by Micha Lenk
SMCRoute is currently maintained by Joachim
and Micha Lenk