UDP unicast to multicast

Hello friends,
Can anyone guide me on how to setup UDP unicast to multicast?
I'm receiving udp unicast packets at my eth0(wan) at the 192.168.1.2 and I want to multicast those udp packets to the eth1(lan) to the 239.0.0.1
Note: router will never be connected to the internet.
lan(eth1) is at the 192.168.10.1 and I can forward those udp packets received at the 192.168.1.2 to the 192.168.10.1 but can't forward to the 239.0.0.1
I'm guessing that there are some configuration for multicast that I'm missing.

This works:
config redirect
option dest 'lan'
option target 'DNAT'
option src 'wan'
option dest_ip '192.168.10.1'
option src_dport '1830'
option dest_port '1830'

But this doesn't work:
config redirect
option dest 'lan'
option target 'DNAT'
option src 'wan'
option dest_ip '239.0.01'
option src_dport '1930'
option dest_port '1930'

Any help will be appreciated. Thanks

https://openwrt.org/docs/guide-user/network/network_configuration#bridge_options
Have you tried the igmp settings under the bridge options?

But you usually don’t receive multicast packages from nowhere or control them by manual firewall rules since they are run at L2 level in the switch. The clients on the inside must sign up for them in the switch controller for the switch to hand them out to the right port.

The only thing the firewall can control is the igmp courier messages that is running around with “the casting address book” on the network.

1 Like

Thanks for the replay. I added " igmp_snooping '1' " on my lan interface. But is not clear to me where should I set the specific ip address and port I want the udp packets to be multicast (apparently is not the firewall as you mentioned). So far, I don't care about receiving multicast, just sending. The device connected to my lan is expecting at the 239.0.0.1 port 1930. Can you give me a hint where should I make this configuration? I installed igmpproxy should I modified the /etc/config/igmpproxy(I haven't found a clear explanation for the different options) I also read about "smcroute".
Many thanks

@flygarn12 is right in that this is a matter of L2 but incoming interface differs from outgoing interface so there is also forwarding. But incoming interface does not know about interest on outgoing interface so igmpproxy may help

igmpproxy needs upstream (sender) and downstream (receiver) interfaces

I do not limit any ports or multicast destinations

my config looks like

root@router:~# cat /etc/config/igmpproxy
config igmpproxy
option quickleave 1

config phyint
option network Video
option zone video
option direction upstream
list altnet 0.0.0.0/0 # a description of allowed source addresses for multicast packets

config phyint
option network TV
option zone iptv
option direction downstream

Thanks for the replay. I modified the /etc/config/igmpproxy
config igmpproxy
option quickleave 1

config phyint
option network WAN
option zone wan
option direction upstream
list altnet 0.0.0.0/0

config phyint
option network LAN
option zone lan
option direction downstream

On my /etc/config/network, I modified:
config route
option interface 'WAN'
option type 'multicast'
option target '224.0.0.0/4'
option gateway '192.168.10.1'

config route
option interface 'LOS'
option type 'multicast'
option target '224.0.0.0/4'
option gateway '192.168.1.4'

config interface 'WAN'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '192.168.1.2'
option device 'eth0'
option igmp_snooping '1'

config interface 'LAN'
option proto 'static'
option device 'eth3'
option netmask '255.255.255.0'
option ipaddr '192.168.10.1'
option gateway '192.168.10.10'
option igmp_snooping '1'

As you can see, I'm adding a route for both WAN and LAN, because I'm not sure who is actually doing the multicast. The WAN interface is receiving the udp packet that I want to multicast through my LAN interface, so my wan should redirect the udp packet to my LAN and it should exit my LAN interface with the multicast address. So, is the Wan only doing a Port Forward to the LAN and the LAN is actually doing the multicast? Or Wan is actually doing the multicast using the LAN gateway? Sorry, networking is new to me; hence, some concepts are not totally clear to me.

/etc/config/firewall
I also added some Traffic Rules:
config rule
list proto 'igmp'
option src 'wan'
option dest 'lan'
option target 'ACCEPT'
list dest_ip '224.0.0.0/4'

and I kept:

config redirect
option dest 'lan'
option target 'DNAT'
option src 'wan'
option dest_ip '239.0.01'
option src_dport '1930'
option dest_port '1930'

Which of course is not working, and I'm not even sure that I'm allowed to do a DNAT to a multicast address.

Any hint?

Many thanks!

there is or should be no NAT involved (unless if you NAT between two 192.168.c.d/24 subnets)

All that multicast needs to know is where receivers are for certain groups.

Also your LAN and WAN seem like private 192.168.c.d/24 subnets which may be subject to not being unicast forwarded.

But again it is about multicast.

In my rc.local I have

ip -4 route add multicast 224.0.0.0/4 dev eth1
ip -4 route append multicast 224.0.0.0/4 dev eth2.30

where eth1 corresponds to outgoing (downstream) and eth2.30 corresponds to incoming (upstream) mullicast interface.

Moreover for potential subnets of sources (of multicast TV channels in my case) I have unicast routes via incoming (upstream) mullicast interface nexthop.

Not sure how I get these but they could be given by provider via special DHCP options (I need to recap since the config is done a few years ago).

But the idea is: have unicast routes to multicast sources in order to succeed RPF (Reverse-path forwarding) check.