# Multicast Router with Gentoo?

## Gatak

Hello,

My ISP is broadcasting TV programs BBC and Discovery over their network with multicast. I'd like to be able to view these TV programs from my LAN clients.

The problem is now on how to make my Gentoo Linux router to work with multicast, and let my clients subscribe to the different channels and receive the multicast data.

I currently have a working linux router with NAT, etc, which I manage with iptables.

I can ping 224.0.0.1 from my LAN clients and my Gentoo box (192.168.0.1) will respond.

My LAN is like this:

LAN[192.168.0.x] <--> [192.168.0.1]-Gentoo-[83.227.154.117] <--> [83.227.154.65]-ISPs router

I get every few seconds a IGMPv2 "Membership Query" from my ISP. They also respond to  ping 224.0.0.1 from my Gentoo box.

How should I setup with iptables, mrouted, or something similar to allow my LAN clients to receive the multicast data from the internet?

----------

## egberts

What you've describe is a end-host multicasting functionality of joining/leaving a multicast group.

To do forwarding, what you appear to need is a multicasting router.

Check out 'emerge mrouted'

----------

## Gatak

Yes, many seem to recommend mrouted. I have tried this program and have yet to get it to work. When running it in debug mode I see my LAN client wanting to join a group. Then I do not see anything more happening really other than membership querries etc. No data is being forwarded nor received from my ISP.

However, if I try to join the multicat group from my router itself, then I am receiving real data from my ISP. I have been unable to forward anything to my LAN clients, with and without mrouted. Has anyone actually used mrouted?

This is the info my ISP gave me regarding the multicc ast channels. If I use VLC - Video LAN Client - to receive the channel on the router itself it works sort of. It would receive video data but be unable to actually decode it. If I try the same from the LAN client nothing would be received.

 *Quote:*   

> National Geo - Mcast adress: 239.1.1.101 - Server IP: 195.54.109.36 - Src
> 
> Port: 1026 - Dest Port: 32287
> 
> BBC World - Mcast adress: 239.1.1.102 - Server IP: 195.54.109.37 - Src
> ...

 

My mrouted.conf contain this:

```
phyint eth0 rate_limit 0

phyint eth1 rate_limit 0
```

Eth1 is my external interface (83.227.154.117) and eth0 my internal (192.168.0.1).

----------

## egberts

Sadly to say, mrouted works best if each and EVERY router in the hop is running an equivalent of an mrouted.

I know many brain-dead ISP don't bother with multicast.  Sometime you can do a mtrace (traceroute equivalence of a multicast).

The tool is located at [url]sourceforge.net/projects/mtrace/[/url] (GENTOO should have this, but its not in the portage)  to determine which multicast hop is broken.

Then, sadly again, lodging a complaint with the midhop backbone provider MAY or MAY NOT result in a suitable resolution.

For me, I always establish a multicast island of which I can join together using GRE tunneling protocol (not the best of both world).

Best wishes.

----------

## Gatak

Well. The multicast from my ISP does work. I do receive multicast querries over IGMP when I monitor with Ethereal. I can join the right multicast group with Video LAN Client on the  Router.

The problem is to get mrouted, or something similar, to allow my LAN clients to join the multicast group and receive the traffic. As far as I have seen they cannot even join the group so the ISP starts sending me the video data. =(

Is there a way for me to debug or anything? I have run mrouted in the console with debug output but I am not sure exactly what to look for.

----------

## adaptr

You do understand that you need to be able to route the multicast packets through your NAT, yes ?

There may be one or more sysctl or kernel options you need to set or tweak.

----------

## Gatak

 *adaptr wrote:*   

> You do understand that you need to be able to route the multicast packets through your NAT, yes ?
> 
> There may be one or more sysctl or kernel options you need to set or tweak.

 Yes you mean muticast forwarding in the kernel?

But this is also my question from the beginning. How would I do this? I have not been able to use iptables to route anything. My kernel has multicast routing enabled as far as I can see. My NICs has multicast enabled too.

Has anyone actually gotten multicast routing to work and not just some unicast tunneling between two hosts?

----------

## Gatak

The problem as I see it is that the router does not proxy the multicast packets.

When I join a group from my LAN, the router would not join the group with the next router. So therefore I would not get any response. Here is some debug output.

Before joining a group from the LAN:

mrouted.cache

```
Multicast Routing Cache Table (0 entries)

 Origin             Mcast-group         CTmr     Age      Ptmr Rx IVif Forwvifs

<(prunesrc:vif[idx]/tmr) prunebitmap

>Source             Lifetime SavPkt         Pkts    Bytes RPFf
```

mrouted.dump

```
vifs_with_neighbors = 0

Virtual Interface Table

Vif  Name  Local-Address                               M  Thr  Rate   Flags

 0   eth0  192.168.0.1     subnet: 192.168.0/24        1   1      0   querier leaf

           group host (time left): 239.255.255.250 192.168.0.10    ( 0:03:42)

                                   224.0.0.4       192.168.0.1     ( 0:03:47)

                                   224.0.0.2       192.168.0.1     ( 0:03:45)

                     IGMP querier: 192.168.0.1        (this system)

                      Nbr bitmaps: 0x0000000000000000

                   pkts/bytes in : 0/0

                   pkts/bytes out: 0/0

 1   eth1  83.227.154.117  subnet: 83.227.154.64/26    1   1      0   leaf

           group host (time left): 224.0.0.2       83.227.154.117  ( 0:03:56)

                                   224.0.0.4       83.227.154.117  ( 0:03:51)

                     IGMP querier: 83.227.154.65      up  0:16:55 last heard  0:00:30 ago

                      Nbr bitmaps: 0x0000000000000000

                   pkts/bytes in : 0/0

                   pkts/bytes out: 0/0

Multicast Routing Table (2 entries)

 Origin-Subnet      From-Gateway    Metric Tmr Fl In-Vif  Out-Vifs

 83.227.154.64/26                      1    45 ..   1    0*

 192.168.0/24                          1    45 ..   0    1*

```

mrouted debug output

```
21:41:39.509 aging forwarding cache entries

21:41:39.509 sending query on vif 0

21:41:39.510 SENT membership query   from 192.168.0.1     to 224.0.0.1

21:41:39.510 update 0 starting at 2 of 2

21:41:39.510 RECV membership query   from 192.168.0.1     to 224.0.0.1

21:41:39.510 ignoring query from 192.168.0.1; querier on vif 0 is still me

21:41:40.509 update 0 starting at 2 of 2

21:41:41.509 update 0 starting at 2 of 2

21:41:42.510 update 0 starting at 2 of 2

21:41:42.534 RECV V2 member report   from 192.168.0.1     to 224.0.0.4

21:41:43.042 RECV V2 member report   from 192.168.0.10    to 239.255.255.250

21:41:43.042 update 0 starting at 2 of 2

21:41:43.318 RECV V2 member report   from 192.168.0.1     to 224.0.0.2

21:41:44.318 aging forwarding cache entries

21:41:44.318 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:41:44.318 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:41:44.318 update 0 starting at 2 of 2

21:41:45.318 update 0 starting at 2 of 2

21:41:46.318 update 0 starting at 2 of 2

21:41:47.318 update 0 starting at 2 of 2

21:41:48.318 update 0 starting at 2 of 2

21:41:49.318 aging forwarding cache entries

21:41:49.318 update 0 starting at 2 of 2

21:41:49.653 RECV membership query   from 83.227.154.65   to 224.0.0.1

21:41:50.930 RECV V2 member report   from 83.227.154.117  to 224.0.0.4

21:41:53.930 aging forwarding cache entries

21:41:53.931 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:41:53.931 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:41:57.219 RECV V2 member report   from 83.227.154.117  to 224.0.0.2

```

Debug output when a LAN client is trying to join a group:

```
21:44:23.966 RECV V2 member report   from 192.168.0.10    to 239.1.1.102

21:44:23.966 group 239.1.1.102 joined on vif 0

21:44:23.966 aging forwarding cache entries

21:44:23.966 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:44:23.966 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:44:23.966 update 0 starting at 2 of 2

21:44:24.542 RECV V2 member report   from 192.168.0.10    to 239.1.1.102

21:44:25.540 update 0 starting at 2 of 2

21:44:25.542 RECV V2 member report   from 192.168.0.10    to 239.1.1.102

21:44:26.540 update 0 starting at 2 of 2

21:44:27.540 update 0 starting at 2 of 2

21:44:28.540 update 0 starting at 2 of 2

21:44:29.540 aging forwarding cache entries

21:44:29.540 update 0 starting at 2 of 2

21:44:30.540 update 0 starting at 2 of 2

21:44:31.540 update 0 starting at 2 of 2

21:44:32.540 update 0 starting at 2 of 2

21:44:33.540 update 0 starting at 2 of 2

21:44:34.540 aging forwarding cache entries

21:44:34.541 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:44:34.541 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:44:34.541 update 0 starting at 2 of 2

21:44:35.540 update 0 starting at 2 of 2

21:44:36.540 update 0 starting at 2 of 2

21:44:37.540 update 0 starting at 2 of 2

21:44:38.545 update 0 starting at 2 of 2

21:44:39.545 aging forwarding cache entries

21:44:39.545 update 0 starting at 2 of 2

21:44:40.545 update 0 starting at 2 of 2

21:44:41.545 update 0 starting at 2 of 2

21:44:42.545 update 0 starting at 2 of 2

21:44:43.545 update 0 starting at 2 of 2

21:44:43.811 RECV leave message      from 192.168.0.10    to 224.0.0.2

21:44:43.811 [vif.c, _accept_leave_message] 0 0

21:44:43.812 SENT membership query   from 192.168.0.1     to 239.1.1.102

21:44:43.812 RECV membership query   from 192.168.0.1     to 239.1.1.102

21:44:43.812 ignoring query from 192.168.0.1; querier on vif 0 is still me

21:44:44.809 aging forwarding cache entries

21:44:44.809 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:44:44.809 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:44:44.809 update 0 starting at 2 of 2

21:44:44.809 SENT membership query   from 192.168.0.1     to 239.1.1.102

21:44:44.810 RECV membership query   from 192.168.0.1     to 239.1.1.102

21:44:44.810 ignoring query from 192.168.0.1; querier on vif 0 is still me

21:44:45.809 update 0 starting at 2 of 2

21:44:46.809 group 239.1.1.102 left on vif 0

21:44:46.809 update 0 starting at 2 of 2

21:44:47.809 update 0 starting at 2 of 2

```

When joining the group from the router instead:

```
21:48:14.386 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:48:14.386 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:48:18.438 RECV V2 member report   from 83.227.154.117  to 239.1.1.102

21:48:18.439 group 239.1.1.102 joined on vif 1

21:48:18.439 add cache entry (83.227.154.117 239.1.1.102) gm:0, parent-vif:1

21:48:18.474 add cache entry (195.54.109.37 239.1.1.102) gm:0, parent-vif:-1

21:48:18.862 RECV V2 member report   from 83.227.154.117  to 239.1.1.102

21:48:19.862 aging forwarding cache entries

21:48:19.862 update 0 starting at 2 of 2

21:48:20.862 update 0 starting at 2 of 2

21:48:21.863 update 0 starting at 2 of 2

21:48:22.863 update 0 starting at 2 of 2

21:48:23.599 RECV V2 member report   from 83.227.154.117  to 239.1.1.102

21:48:23.599 update 0 starting at 2 of 2

21:48:24.599 aging forwarding cache entries

21:48:24.599 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:48:24.599 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

[...] (video data is received by the media player on the router. Then I click stop.)

21:48:54.657 SENT neighbor probe     from 192.168.0.1     to 224.0.0.4

21:48:54.657 SENT neighbor probe     from 83.227.154.117  to 224.0.0.4

21:48:55.140 RECV leave message      from 83.227.154.117  to 224.0.0.2

21:48:55.183 RECV membership query   from 83.227.154.65   to 239.1.1.102

21:48:55.183 Group-specific membership query for 239.1.1.102 from 83.227.154.65 on vif 1, timer 10

21:48:55.184 timer for grp 239.1.1.102 on vif 1 set to 2

21:48:56.053 RECV membership query   from 83.227.154.65   to 239.1.1.102

21:48:56.053 Group-specific membership query for 239.1.1.102 from 83.227.154.65 on vif 1, timer 10

21:48:57.053 group 239.1.1.102 left on vif 1
```

----------

## agit8or

Hi,

I managed to route multicast traffic from my ISP through my firewall/gateway using static routes and the smcroute daemon (don't know if this is in portage)

I assume your ISP is Bredbandsbolaget, right? They multicast these three channels in their net. Anyway, this is the way I once got it to work

```

# start daemon

bin/smcroute -d

# add routes for national geographic channel

bin/smcroute -a eth2 195.54.109.36 239.1.1.101 eth0

# join national geographic channel

# http://www.bredband.net/jsp/pctv/Channel/4b.asx

bin/smcroute -j eth2 239.1.1.101

```

Then just click the link on the ISP homepage  (windows media player is unfortunately the only supported player as far as I know.) The IP addresses might have changed though so make sure they are correct. I sniffed up the source address of the stream using iptraf on the router.

Regards,

Tobias

----------

## Gatak

 *agit8or wrote:*   

> Hi,
> 
> I managed to route multicast traffic from my ISP through my firewall/gateway using static routes and the smcroute daemon (don't know if this is in portage)
> 
> I assume your ISP is Bredbandsbolaget, right? They multicast these three channels in their net. Anyway, this is the way I once got it to work
> ...

 

Thanks! It works! Truly amazing  :Smile:  I have no idea why it wouldn't work with mrouted. In any case, it doesn't matter to much either =) I can make my own script to enable/disable too. And yes, I use Bredbandbolaget  :Smile: 

----------

## agit8or

 *Gatak wrote:*   

> 
> 
> Thanks! It works! Truly amazing  I have no idea why it wouldn't work with mrouted. In any case, it doesn't matter to much either =)

 

I know, been there too! It's such a simple thing to do so I don't see how things would go wrong with mrouted. Anyway, all we need now is a player that works in linux. Let me know if you find one.

----------

## Gatak

 *agit8or wrote:*   

>  *Gatak wrote:*   
> 
> Thanks! It works! Truly amazing  I have no idea why it wouldn't work with mrouted. In any case, it doesn't matter to much either =) 
> 
> I know, been there too! It's such a simple thing to do so I don't see how things would go wrong with mrouted. Anyway, all we need now is a player that works in linux. Let me know if you find one.

 

What I find so difficult to understand is that there is absolutely no documentation, examples, anything on the net that describes people having problem with mrouted and so there are no solutions to find.

Yes I tried at first with VLC (www.videolan.org) and that didn't work. It doesn't have support for NSC files, nor for WMV9 which BBB is broadcasting with. Perhaps mplayer could work, though I haven't seen it to have multicast support.

----------

## thepustule

I've been trying the same thing here with mrouted.

I have a Linux firewall router with 3 interfaces.  One for the internet, one for wired lan, and the other for a "Wireless DMZ" where my access point sits.

I want to be able to multicast TV using VLC from a LAN client and pick it up on a wireless client.

Same trouble - no matter what I do, linux won't forward the packets.

Is there no one out there doing multicast?

----------

