Broadcast (e.g. 255.255.255.255) across subnets smcroute

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Tue Dec 10, 2024 6:06    Post subject: Broadcast (e.g. 255.255.255.255) across subnets smcroute Reply with quote
I have my host network 192.168.1.X on br0 and an IoT network on a VLAN on br1 on 192.168.100.x, with a device on 192.168.100.3
- br0 can pass traffic freely to br1
- br1 is locked down except for DNS, mDNS, and UDP ports 9999, 20002
- mDNS resolver and repeater are enabled

All the following work properly
- I can avahi-browse from br0 to see the devices on br1
- Devices on br1 have DNS service and can access the Internet
- I can ping devices on the br1 network from br0
- I can unicast from br0 to any IP address & port on br1, e.g, "echo hello | nc -u 192.168.100.3 20002" and see the packets in Wireshark on 192.168.100.3


HOWEVER, I can't seem to broadcast to br1 (even with the firewall disabled)
e.g., "echo hello | nc -u -b 255.255.255.255 20002" FAILS to register on Wireshark on 192.168.100.3

It seems like I need to do something additional to get multicast working across subnets.
What am I missing?

Thanks!
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13647
Location: Netherlands

PostPosted: Tue Dec 10, 2024 7:00    Post subject: Reply with quote
You need something like smcroute, but I do not know if Entware has it
_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Tue Dec 10, 2024 9:42    Post subject: Reply with quote
Thanks. I installed 'smcroute' from Entware.

I configured /etc/smcroute.conf as:
Code:

mgroup from br0 group 225.255.255.255
mroute from br0 group 255.255.255.255 to br1


Then ran: smcrouted -e /etc/smcroute.conf

But broadcast messages still didn't go through to br3

Do I need to turn on any of the usually disabled 'Multicast Forwarding' message options in the bridge setup page?
Any other suggestions...

I feel like I am so close yet so far away Smile
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13647
Location: Netherlands

PostPosted: Tue Dec 10, 2024 10:08    Post subject: Reply with quote
I think there is a thread in the forum about it you need a lot of iptables to make traffic possible
_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Tue Dec 10, 2024 16:46    Post subject: Reply with quote
Note, there was a typo above in my invocation of 'smcrouted', the flag should be '-f' and not 'e'.
However, when I checked my conf file with the '-F' flag, I got the following error message:
Code:

smcrouted -F /opt/etc/smcroute.conf.jnew
Verifying configuration file /opt/etc/smcroute.conf.jnew ...
/opt/etc/smcroute.conf.jnew line 2: mroute: Invalid multicast group: 255.255.255.255
Parse error in /opt/etc/smcroute.conf.jnew


So it seems like 'smcroute' works for multicast but not simple broadcast.

So back to the question:
How do I get a broadcast on 192.168.1.1 to 255.255.255.255 to be broadcast also on the 192.168.100.x subnet?
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Tue Dec 10, 2024 16:49    Post subject: Reply with quote
So I tried to see what happens when I broadcast within vs. cross-subnets:

The following broadcasts work within my primary 192.168.1.x net (and are detected by wireshark)
- echo hello | nc -u -b 255.255.255.255
- echo hello | nc -u -b 192.168.1.255
As does the following unicast
- echo hello | nc -u 192.168.1.3 (where 192.168.1.3 is the IP address of the computer I am monitoring with wireshark)

In contrast, when sending from 192.168.1.x to the 192.168.100.x subnet:
The following cross-subnet unicast works when run from the 192.168.1.x net
- echo hello | nc -u 192.168.100.100 (assuming the monitored computer has IP address 192.168.100.3)
But the following cross-subnet broadcasts all fail from the 192.168.1.x net when monitored on the 192.168.100.x subnet
- echo hello | nc -u -b 255.255.255.255
- echo hello | nc -u -b 192.168.100.255

I tried adding the following iptables rules, but they didn't help
Code:

iptables -t nat -I PREROUTING -d 255.255.255.255 -p udp --dport 20002 -j DNAT --to-destination 192.168.100.255
iptables -I FORWARD -p udp --dport 20002 -d 192.168.100.255 -j ACCEPT

But that didn't work
I even tried *temporarily* accepting everything on br1
Code:

iptables -I INPUT -i br1 -j ACCEPT
iptables -I FORWARD -i br1 -j ACCEPT

But that didn't help either

I also tried turning on multicast forwarding for br1 (in Setup->Networking) but that didn't help.

So, what do I need to do so that 255.255.255.255 broadcasts initiating on 192.168.1.x are routed cross-net to individual devices on the 192.168.100.x subnet?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13647
Location: Netherlands

PostPosted: Wed Dec 11, 2024 10:48    Post subject: Reply with quote
You must setup smcroute see:
https://github.com/troglobit/smcroute
https://an0n-r0.medium.com/making-dlna-through-site-to-site-vpn-work-f393629f4ce0

I moved this thread to the Advanced networking forum.

I just added smcroute to my build, will have a look at it after the holidays

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13647
Location: Netherlands

PostPosted: Wed Dec 25, 2024 16:35    Post subject: Reply with quote
I am adding smcroute to my build and got an error about missing kernel modules.

This is for Kernel 4.4.

Not sure if these are automatically added when you use the entware smcroute but I doubt it.

Set the logging to high and send to syslog to see what is going on, you might even set log level to debug:
Quote:
smcrouted -s -f <conffile> -l info


see: https://man.troglobit.com/man8/smcrouted.8.html

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 7032
Location: Romerike, Norway

PostPosted: Wed Dec 25, 2024 17:03    Post subject: Reply with quote
Broadcast is Layer 2 (Mac Layer) and will not traverse to other sub-nets because they are not on the same Ethernet.

Can't DLNA use mDNS Multicast for Discovery?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13647
Location: Netherlands

PostPosted: Wed Dec 25, 2024 17:21    Post subject: Reply with quote
Per Yngve Berg wrote:
Broadcast is Layer 2 (Mac Layer) and will not traverse to other sub-nets because they are not on the same Ethernet.

Can't DLNA use mDNS Multicast for Discovery?


DLNA uses SSDP, to make that travel between subnets you need something like smcroute.
avahi/mdns can be used e.g. for a Chromecast which uses mDNS

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Tue Jan 07, 2025 15:30    Post subject: Reply with quote
egc wrote:
You must setup smcroute see:
https://github.com/troglobit/smcroute
https://an0n-r0.medium.com/making-dlna-through-site-to-site-vpn-work-f393629f4ce0


I reviewed the above carefully and I think the problem remains that I am trying to forward udp broadcast packets (i.e., 255.255.255.255) but smcroute only works on multicast.

Indeed /var/log/messages shows:
Code:

daemon.warn smcroute[5706]: /tmp/smcroute.conf line 1: join: Invalid multicast group: 255.255.255.255
daemon.warn smcroute[5706]: /tmp/smcroute.conf line 2: mroute: Invalid multicast group: 255.255.255.255

where my /tmp/smcroute.conf file looks like:
Code:

mgroup from br0 group 225.255.255.255
mroute from br0 group 255.255.255.255 to br1


Unfortunately, the messages that I am trying to forward (TP-LINK Kasa discovery messages) are broadcast...

I imagine I can't be the only person trying to get broadcast discovery messages to be forwarded from a primary subnet to an IOT subnet...

I read elsewhere that a program "udp-broadcast-relay" may be able to handle such forwarding BUT it doesn't seem available in entware.


Quote:
I just added smcroute to my build, will have a look at it after the holidays

Hope you had a wonderful holiday Smile
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 184

PostPosted: Thu Feb 13, 2025 17:34    Post subject: Reply with quote
OK, I finally go it to work by compiling and installing `udp-broadcast-relay` (https://github.com/nomeata/udp-broadcast-relay) on my dd-wrt router.
I then ran:
Code:

udp-broadcast-relay -f 1 9999 br1 br0
udp-broadcast-relay -f 2 20002 br1 br0

And added the following iptables rules on the router:

Code:

iptables -I FORWARD -d myserver.mydomain -i br1 -p udp -m udp --sport 9999 -j ACCEPT
iptables -I FORWARD -d myserver.mydomain -i br1 -p udp -m udp --sport 20002 -j ACCEPT


where my use case is getting 'kasa discover' (either standalone or via homeassistant) to work from my IoT subnet to my main network.

Note:
- myserver.mydomain` is the machine and `br0` is the network bridge where I am running kasa discover (or if using homeassistant, substitute the name or ip address of your homeassistant installation, typically `homeassistant`)
- `br1` is the IoT network bridge where my kasa devices are installed

Note that `udp-broadcast-relay` is a small, easy to compile program. I just had to run 'make' to get it to compile under dd-wrt (where I have gcc installed via entware)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum