Add permament route for multicast support over LAN

I am using a program that needs multicast support on LAN.

When I strat the program I would sometime get the following error

image

After searching for the reasons I got to know that for multicast to work i have to add a route as follows

route add -net 224.0.0.0 netmask 224.0.0.0 br-lan

Adding the above makes it work fine but I think its temporaryly added .

the same problem satrts after some time and I have to add it gain. How can I make it permanent

I can add this in rc.local , but I am wondering if there is some proper way to do it!

Or from Luci Network-Static Routes

2 Likes

I added at the end of /etc/config/network

 config route
        option interface 'br-lan'
        option target '224.0.0.0'
        option netmask '224.0.0.0'
        option gateway '192.168.1.1'

but it doesnt work
image

if I run the follwing command
route add -net 224.0.0.0 netmask 224.0.0.0 br-lan

then it will be
image

which is desired and lets my multicast work

First the mask is wrong, should be 240.0.0.0
Then you don't need to add the gateway, moreover it is wrong.
Last in both cases you have not specified that the route is multicast.

1 Like

changed that

root@WIFI:~# tail /etc/config/network

config route
        option interface 'br-lan'
        option target '224.0.0.0'
        option netmask '240.0.0.0'
        option type 'multicast'

but route result i still

image

And my program will fail

root@magiatiko / > tail -n 6 /etc/config/network ; ip -4 ro | grep multi
config route
        option type 'multicast'
        option interface 'lan'
        option target '224.0.0.0'
        option netmask '240.0.0.0'

multicast 224.0.0.0/4 dev eth0.4 proto static scope link

uci name for interface is lan, not br-lan

1 Like

image

Fix the interface name and install ip-tiny or ip-full

1 Like

changed the interface to lan , but it didnt work even now ,

ip -4 ro ?

I am unable to install ip-tiny or ip-full.

I am follwoing this and this works until the device is rebooted from here https://openwrt.org/docs/guide-user/network/wan/udp_multicast

Maybe @dlakelan can chip in here, since he last edited the guide.

1 Like

Sure, as I understand it, multicast routing is different from unicast routing. A multicast route needs to be installed by a multicast routing daemon and remains in the multicast routing table only so long as the daemon remains running. To statically route multicast you use smcroute and to dynamically route multicast you use igmpproxy or for bigger installations things like PIM-SM protocol.

It sounds like you want a static route so try smcroute.

1 Like

opkg update; opkg install ip-full

2 Likes

@dmsherazi ,

Sorry for the stupid question in advance, when you edited the /etc/config/network have you restarted network daemon (/etc/init.d/network restart) ?

Yes I did restart it

Hi , do you have any suggestions, I am still unable to fix the issue

Hi @dmsherazi ,

Is IGMP snooping enabled on interface LAN? (Luci: Interfaces/LAN/Physical Settings) If not, please set it.