-   Linux - Networking (
-   -   Multicast traffic not forwarded when using a Linux system as a router (

anon_16 01-08-2014 07:47 AM

Multicast traffic not forwarded when using a Linux system as a router
My simple setup: A Linux system with 2 NICs and one laptop connected to each of the NICs. The laptops are in different subnets. Let's say that one laptop is and the other is I have assigned an IP in the same subnet to the corresponding NICs - i.e and I am running a simple multicast sender on one laptop and its corresponding receiver on the other. I know that this is possible using a Bridge, but I need this to take place at Layer 3 - i.e as a router.

I have enabled IP_FORWARD, disabled RP_FILTER for both the interfaces and "all", enabled MC_FORWARDING for both the interfaces and "all". In the kernel- IP_MULTICAST,IP_MROUTE and IP_PIMSM are enabled.
My route entries are :
route add -net gw dev eth0
route add -net gw dev eth1
With this I am able to ping one laptop from the other.
Since the multicast code needs a device to act upon, I use [route add default dev <device>] at the laptops. I check the traffic at the router using Wireshark and Tcpdump.

The multicast senders' packets reach the interface the laptop is connected to but they are not forwarded on to the other interface. I only receive join and leave group messages on the other interface from the receiver side. I have tried different combinations of these steps and routes including the multicast route [route add -net dev <device>] at the router interfaces. I have tried using smcroute, mrouted and pimd extensively. I have used different physical systems as the router and also Ubuntu and RHEL. I have used different multicast packet generators.
But it simply does not forward the packets. Any ideas?

nini09 01-08-2014 03:55 PM

Before you can do any multicast routing, you need to configure the Linux kernel to support the type of multicast routing you want to do. This, in turn, requires you to decide what type of multicast routing you expect to be using. There are essentially four "common" types - DVMRP (the Multicast version of the RIP unicast protocol), MOSPF (the same, but for OSPF), PIM-SM ("Protocol Independent Multicasting - Sparse Mode", which assumes that users of any multicast group are spread out, rather than clumped) and PIM-DM (the same, but "Dense Mode", which assumes that there will be significant clumps of users of the same multicast group).

anon_16 01-10-2014 07:02 AM

It seems that it takes 2 - 3 minutes for Mrouted to finish the IGMP transactions. Then magically ,the multicast packets are forwarded and received. So, the answer to my question was simply Patience.
Now, my problem extends a little further. The interface links on my router will not be "up" permanently. I need to be able to arbitrarily disturb them i.e pull the cables out manually by hand, if you will - and then receive the packets again immediately when I plug it back in. I believe Mrouted requires both the interfaces to be up all the time and disturbing any of the links stops the forwarding from that point on. Is it due to the dynamic nature of Mrouted ? Is there any other way to set static routes, besides smcroute, so the routes are not removed when the links are disturbed ?

nini09 01-10-2014 03:39 PM

The smcroute is good one. By the way, dynamic route is good even if the link is disturbed, isn't it?

anon_16 01-11-2014 02:50 AM

No, it isn't. Mrouted requires at least two interfaces to be up and running in order to function. When the cables are removed and plugged back in, it needs time to send the IGMP join messages all over again. In short, it will work - but after a short delay, which I cannot afford to have.
Anyway, I think I'm onto something with smcroute - I found a few steps somewhere in Russian that I used Google Translate on. If it works I'll let you know.

anon_16 01-13-2014 07:51 AM

Chipped off a little more of the wall of my problems : I got smcroute to work. Turns out the source IP address I was using while adding the routes was the problem. When I set the address to i.e any source address , it starts forwarding the multicast packets. And as I had predicted, the static routes remained in place even after I disturbed the links - so now, the transition is seamless.

This is about 25% of what I am trying to achieve. And the next part goes a little bit outside the scope of my title topic. Should I start a new thread or continue with this one?

zhjim 01-13-2014 09:07 AM

I was following the thread silently so also the mods will kill me. But go in this one please. Or provide link to the new post.

anon_16 01-22-2014 04:45 AM

Turns out that smcroute is pretty unstable as well. After 4 - 5 minutes of repeated link abuse, the packets do not get forwarded anymore even though the routes are shown to be in place. You can check them using ip mroute show. So I had to kill the smcroute daemon and run it again every time it went down.
By the way, I needed these static routes for testing purposes only and smcroute was reliable enough. I will be making use of a Cisco L3 switch in the place of my Linux router in the future. My "research" :p will take some time and if you leave this thread open I will post the results of my findings.

All times are GMT -5. The time now is 05:31 AM.