Linux is, of course (you doubted it?), full Level-2 Multicast-Compliant. It meets all requirements to send, receive and act as a router (mrouter) for multicast datagrams.
If you want just to send and receive, you must say yes to "IP: multicasting"
when configuring your kernel. If you also want your Linux box to act as a
multicast router (mrouter) you also need to enable multicast routing in the
kernel by selecting "IP: forwarding/gatewaying", "IP: multicast routing"
and "IP: tunneling", the latter because new versions of mrouted
rely on IP tunneling to send multicast datagrams encapsulated into unicast
ones. This is necessary when establishing tunnels
between multicast hosts separated by unicast-only networks and routers.
(The mrouted
is a daemon that implements the multicast routing algorithm
-the routing policy- and instructs the kernel on how to route multicast
datagrams).
Some kernel versions label multicast routing as "EXPERIMENTAL", so you should enable "Prompt for development and/or incomplete code/drivers" in the "Code maturity level options" section.
If, when running the mrouted
, traffic generated in the same network your
Linux box is connected to is correctly forwarded to the other network, but
you can't see the other's network traffic on your local network, check
whether you are receiving ICMP protocol error messages. Almost sure
you forgot to turn on IP tunneling in your Linux router. It's a kind of
stupid error when you know it but, believe me, its quite time-consuming
when you don't, and there is no apparent reason that explains what is going
wrong. A sniffer proves to be quite useful in these situations!
(You can see more on multicast routing on section
Routing Policies and Forwarding Techniques; mrouted
and
tunnels are also explained in sections
The MBone and
Multicast applications).
Once you have compiled and installed your new kernel, you should provide a default route for multicast traffic. The goal is to add a route to the network 224.0.0.0.
The problem most people seem to face in this stage of the configuration is with the value of the mask to supply. If you have read Terry Dawson's excellent NET-3-HOWTO, it should not be difficult to guess the correct value, though. As explained there, the netmask is a 32 bit number filled with all-1s in the network part of your IP address, and with all-0s in the host part. Recall from section 2.1 that a class D multicast address has no netwok/host sections. Instead it has a 28-bit group identifier and a 4-bit class D identifier. Well, this 4 bits are the network part and the remaining 28 the host part. So the netmask needed is 11110000000000000000000000000000 or, easier to read: 240.0.0.0. Then, the full command should be:
route add 224.0.0.0 netmask 240.0.0.0 dev eth0
Depending on how old your route
program is, you might need to add
the -net
flag after the add
.
Here we supposed that eth0
was multicast-capable and that, when not
otherwise specified, we wanted multicast traffic to be output there.
If this is not your case, change the dev
parameter as appropriate.
The /proc
filesystem proves here to be useful once again: you
can check /proc/net/igmp
to see the groups your host is
currently subscribed to.