Static multicast routing daemon, Linux & BSD. This is the official new home of SMCRoute. New features: config file support, capable of reloading on SIGHUP, source-less on-demand routing, a.k.a. (*,G) based static routing.
C Groff M4 Shell Makefile
Latest commit 854577c Sep 24, 2016 @troglobit README: Document kernel config requirements Linux + BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Permalink
Failed to load latest commit information.
m4 Fix #26: Add Linux socket filter for routed data from joined groups Feb 8, 2016
.gitignore Update .gitignore Feb 1, 2016
.travis.yml Update Travis-CI, libcap-dev now required Aug 31, 2016
AUTHORS Update with info on new maintainership of mainline smcroute at GitHub. Dec 13, 2011
CONTRIBUTING.md Detail how to contribte most effectively to the SMCRoute project Feb 8, 2016
COPYING Initial import of smcroute v0.95 Oct 9, 2011
ChangeLog.md Update ChangeLog and bump version to v2.2-rc1 Sep 15, 2016
Makefile.am Support building without libcap Sep 1, 2016
README.md README: Document kernel config requirements Linux + BSD Sep 24, 2016
TODO Support building without libcap Sep 1, 2016
_mcclient.c Remove Emacs version-control handling May 7, 2016
autogen.sh Do not force automake v1.11, configure already checks for at least v1.11 Oct 31, 2015
cmdpkt.c Remove Emacs version-control handling May 7, 2016
configure.ac Update ChangeLog and bump version to v2.2-rc1 Sep 15, 2016
ifvc.c Replace %m GNUism with %s and strerror() Aug 31, 2016
ipc.c Remove Emacs version-control handling May 7, 2016
log.c Remove Emacs version-control handling May 7, 2016
mcgroup.c Replace %m GNUism with %s and strerror() Aug 31, 2016
mclab.h Compat: Add OpenBSD queue.h since musl libc has no sys/queue.h Aug 31, 2016
mroute-api.c Minor code/style cleanup and refactor Aug 31, 2016
parse-conf.c Remove Emacs version-control handling May 7, 2016
pidfile.c Update to OpenBSD pidfile.c v1.11 with libite ext. Jul 4, 2016
queue.h Compat: Add OpenBSD queue.h since musl libc has no sys/queue.h Aug 31, 2016
smcroute.8 Document new -p USER:GROUP option in man page Sep 1, 2016
smcroute.c Move comment about dropping root to inside #ifdef Sep 2, 2016
smcroute.conf Update note on max 20 mgroups on Linux Feb 18, 2016
smcroute.init Fix issue #9: Add SysV init script. Courtesy of Debian. Sep 29, 2014

README.md

SMCRoute - A static multicast routing daemon

Travis Status Coverity Status

SMCRoute is a command line tool to manipulate the multicast routes in the UNIX kernel. It supports both IPv4 and IPv6 multicast routing.

SMCRoute can be used as an alternative to dynamic multicast routers like mrouted or pimd in setups where static multicast routes should be maintained and/or no proper IGMP or MLD signaling exists.

Multicast routes exist in the UNIX kernel only as long as a multicast routing daemon is running. Only one multicast routing daemon can be active at a time, so it's impossible to run SMCRoute and, e.g., mrouted at the same time. Linux does however support multiple routing tables, which SMCRoute not yet supports.

SMCRoute is maintained collaboratively at GitHub. Previously the code was hosted and maintained by Debian at Alioth and before that by Carsten Schill, the original author.

Usage

SMCRoute is both a daemon and a client. You must start the daemon first to be able to set up multicast routes.

# smcroute -d

or

# smcroute -d -N

or

# smcroute -d -e /path/to/script

The latter syntax calls your own script whenever smcroute receives a SIGHUP or installs a multicast route to the kernel. This is useful if you, for instance, also run a NAT firewall and need to flush connection tracking after installing a multicast route.

With the -N command line option SMCRoute does not prepare all system interfaces for multicast routing. Very useful if your system has a lot of interfaces but only a select few are required for multicast routing. Use the following configuration file syntax to enable interfaces:

phyint eth0 enable
phyint eth1 enable
phyint eth2 enable

By default SMCRoute looks for its configuration in /etc/smcroute.conf, which can look something like this:

mgroup from eth0 group 225.1.2.3
mroute from eth0 group 225.1.2.3 source 192.168.1.42 to eth1 eth2

The first line means "Join multicast group 225.1.2.3 on interface eth0", and is for layer-2 devices (switches) with IGMP snooping implemented to open up multicast for that group to be flooded to us. You should not need the mgroup line, it will cause routing performance loss and is only intended to be used when you have problems with switches that do not forward multicast to us by default. Only 20 groups can be "joined" this way, for more groups you should investigate the root cause for not receiving multicast at the multicast router, or use a dynamic multicast routing protocol.

The second mroute line is the actual layer-3 routing entry. Here we say that multicast data originating from 192.168.1.42 on eth0 to the multicast group 225.1.2.3 should be forwarded to interfaces eth1 and eth2.

Note: To test the above you can use ping from another device. The multicast should be visible as long as your IP# matches the source above and you ping 225.1.2.3 AND REMEMBER TO SET TTL >1!

$ ping -I eth0 -t 2 225.1.2.3

The TTL is what usually bites people trying out multicast the first time. There is a good reason for applications, e.g., ping to default to a TTL=1 for multicast. That is to reduce the risk of flooding your network with data, remember multicast is like broadcast in nature. Only IGMP snooping aware switches can help mitigate its broadcast effect.

Traditionally, however, SMCRoute only had the client interface to interact with the daemon. To achieve the above two config file lines you have to:

# sleep 1

To allow the daemon to startup properly (above) before interacting with it.

# smcroute -j eth0 225.1.2.3
# smcroute -a eth0 192.168.1.42 225.1.2.3 eth1 eth2

Experimental

Many people sometimes do not know where the multicast will originate from, or it will originate from several different sources but never at the same time. Up until 1.98.3 a user had to setup a unique routing rule for each possible source and group to be routed. However, as of 1.99.0 it is possible to use the wildcard address 0.0.0.0 (INADDR_ANY) for IPv4 multicast routes.

Example smcroute.conf:

mgroup from eth0 group 225.1.2.3
mroute from eth0 group 225.1.2.3 to eth1 eth2

or, from the command line:

# smcroute -j eth0 225.1.2.3
# smcroute -a eth0 0.0.0.0 225.1.2.3 eth1 eth2

Build & Install

SMCRoute should in theory work on any UNIX like operating system which supports the BSD MROUTING API. Both Linux and FreeBSD are tested on a regular basis.

On Linux the following kernel config is needed:

CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y

Check the list of multicast capable interfaces:

cat /proc/net/dev_mcast

On *BSD:

options    MROUTING    # Multicast routing
options    PIM         # Enable for pimd

As of SMCRoute v2.2, the libcap library is required for full privilege separation using POSIX capabilities. At startup this library is used to drop full root privileges, retaining only CAP_NET_ADMIN for managing the multicast routes.

$ ./configure
$ make -j5
$ sudo make install-strip

Good Luck!
The SMCRoute Maintainers