The ip and smcroute Multicast Utilities

Linux multicast setup is performed via the ip utility. smcroute(8) is an alternative to ip and to mrouted/pimd, which manipulates Linux kernel multicast routes statically. You can find this utility at http://www.cschill.de/smcroute; it might come in handy in the absence of mrouted/pimd or if you lack IGMP signaling. This utility essentially adds/removes multicast routes and joins/leaves multicast groups. You can start smcroute as a daemon by typing smcroute -d, whereas ip is just a powerful vehicle to manipulate the kernel multicast settings. Example 14-12 offers an example of joining a multicast group via smcroute as well as adding a static multicast routing entry. Example 14-13 summarizes the multicast command section of the Linux ip utility.

Example 14-12. smcroute Utility

[root@callisto:~#] smcroute -h

usage: smcroute [-v] [-d]

            [-a <InputIntf> <OriginIpAdr> <McGroupAdr> <OutputIntf> [<OutputIntf>] ...]

                [-r <InputIntf> <OriginIpAdr> <McGroupAdr>]

                [-j <InputIntf> <McGroupAdr>]

                [-l <InputIntf> <McGroupAdr>]



[root@callisto:~#] smcroute ?d



[root@callisto:~#] smcroute  -j eth1 224.7.7.7



[root@callisto:~#] smcroute  -a eth1 182.168.2.254 224.4.4.4 eth0



[root@callisto:~#] netstat -g

IPv6/IPv4 Group Memberships

Interface       RefCnt Group

--------------- ------ ---------------------

lo              1      ALL-SYSTEMS.MCAST.NET

eth0            1      ALL-SYSTEMS.MCAST.NET

eth1            1      224.7.7.7

eth1            1      224.2.2.2

eth1            1      NTP.MCAST.NET

eth1            1      ALL-SYSTEMS.MCAST.NET



[root@callisto:~#] ip mroute show

(182.168.2.254, 224.4.4.4)       Iif: eth1       Oifs: eth0

(192.168.1.1, 224.2.2.2)         Iif: unresolved

(192.168.2.7, 224.2.2.2)         Iif: unresolved


NOTE

Only one multicast router daemon can be active at any time. It is impossible to run smcroute and mrouted or pimd simultaneously.


Example 14-13. Multicast Commands of the ip Utility

[root@callisto:~#] ip mroute help

Usage: ip mroute show [ PREFIX ] [ from PREFIX ] [ iif DEVICE ]



[root@callisto:~#] ip maddr help

Usage: ip maddr [ add | del ] MULTIADDR dev STRING

       ip maddr show [ dev STRING ]



[root@callisto:~#] ip -s mroute

(192.168.2.7, 224.2.2.2)         Iif: eth1

  4169 packets, 621166 bytes

(192.168.1.1, 224.2.2.2)         Iif: eth1

  6302 packets, 2012324 bytes

(192.168.1.1, 224.0.1.1)         Iif: eth1

  315 packets, 10184 bytes



[root@callisto:~#] ip -s maddr

1:      lo

        inet  224.0.0.1

2:      eth0

        link  01:00:5e:00:00:02

        link  01:00:5e:00:00:04

        link  01:00:5e:00:00:01

        inet  224.0.0.2

        inet  224.0.0.4

        inet  224.0.0.1

3:      eth1

        link  01:00:5e:02:02:02

        link  01:00:5e:00:01:01

        link  01:00:5e:00:00:02

        link  01:00:5e:00:00:04

        link  01:00:5e:00:00:01

        inet  224.2.2.2

        inet  224.0.1.1

        inet  224.0.0.2

        inet  224.0.0.4

        inet  224.0.0.1