3

I am trying to forward broadcast packets from one LAN to another LAN using OpenWRT. My setup looks like this: network setup (Netgear R6080 Router, OpenWrt SNAPSHOT r20168-b2681e584c / LuCI Master git-22.203.79817-25dcd0b)

I've got port forwarding set up between the two LANs just fine, but my software on the computer generates hearbeat packets and sends them to the broadcast ip 255.255.255.255, port 7001, but the circuit board is not receiving them. Therefore, I assume packets sent to the broadcast IP can only be received by devices on the same LAN, and therefore I need to forward them to the other LAN somehow.

According to the wiki, this is done with the igmpproxy package. I've installed the package and configured it as such:

config igmpproxy
        option quickleave 1
        option verbose 3
#       [0-3](none, minimal[default], more, maximum)

config phyint
        option network lan
        option zone lan
        option direction upstream
        list altnet 192.168.0.0/16

config phyint
        option network LAN_ROBOT
        option zone lan_robot
        option direction downstream

After restarting the service, I am not seeing any indication that the circuit is recieving the packets and this is the output I see from the system logs:

Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Searching for config file at '/var/etc/igmpproxy.conf'
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: Quick leave mode enabled.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: Got a phyint token.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Config for interface br-lan.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got upstream token.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got ratelimit token '0'.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got threshold token '1'.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got altnet token 192.168.0.0/16.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Altnet: Parsed altnet to 192.168/16.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: IF name : br-lan
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Next ptr : 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Ratelimit : 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Threshold : 1
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: State : 1
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Allowednet ptr : 77e0bc50
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: Got a phyint token.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Config for interface eth0.3.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got downstream token.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got ratelimit token '0'.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Config: IF: Got threshold token '1'.
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: IF name : eth0.3
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Next ptr : 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Ratelimit : 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Threshold : 1
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: State : 2
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Allowednet ptr : 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: buildIfVc: Interface lo Addr: 127.0.0.1, Flags: 0x0049, Network: 127/8
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: buildIfVc: Interface eth0.3 Addr: 192.168.200.1, Flags: 0x1043, Network: 192.168.200/24
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: buildIfVc: Interface eth0.2 Addr: 10.0.0.93, Flags: 0x1043, Network: 10.0.0/24
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: buildIfVc: Interface br-lan Addr: 192.168.1.1, Flags: 0x1043, Network: 192.168.1/24
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Found config for eth0.3
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Found config for br-lan
Wed Jul 27 21:04:52 2022 user.notice igmpproxy[10930]: adding VIF, Ix 0 Fl 0x0 IP 0x01c8a8c0 eth0.3, Threshold: 1, Ratelimit: 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]:         Network for [eth0.3] : 192.168.200/24
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Found upstrem IF #0, will assing as upstream Vif 3
Wed Jul 27 21:04:52 2022 user.notice igmpproxy[10930]: adding VIF, Ix 1 Fl 0x0 IP 0x0101a8c0 br-lan, Threshold: 1, Ratelimit: 0
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]:         Network for [br-lan] : 192.168.1/24
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]:         Network for [br-lan] : 192.168/16
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Got 262144 byte buffer size in 0 iterations
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Joining all-routers group 224.0.0.2 on vif 192.168.200.1
Wed Jul 27 21:04:52 2022 user.notice igmpproxy[10930]: Joining group 224.0.0.2 on interface eth0.3
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Joining all igmpv3 multicast routers group 224.0.0.22 on vif 192.168.200.1
Wed Jul 27 21:04:52 2022 user.notice igmpproxy[10930]: Joining group 224.0.0.22 on interface eth0.3
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: SENT Membership query   from 192.168.200.1   to 224.0.0.1
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Sent membership query from 192.168.200.1 to 224.0.0.1. Delay: 10
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Created timeout 1 (#0) - delay 10 secs
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: (Id:1, Time:10)
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: Created timeout 2 (#1) - delay 21 secs
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: (Id:1, Time:10)
Wed Jul 27 21:04:52 2022 user.debug igmpproxy[10930]: (Id:2, Time:21)
Wed Jul 27 21:04:52 2022 user.notice igmpproxy[10930]: RECV Membership query   from 192.168.200.1   to 224.0.0.1
Wed Jul 27 21:04:55 2022 user.notice igmpproxy[10930]: The IGMP message was local multicast. Ignoring.
Wed Jul 27 21:04:56 2022 user.notice igmpproxy[10930]: RECV V2 member report   from 192.168.1.1     to 224.0.0.106
Wed Jul 27 21:04:56 2022 user.notice igmpproxy[10930]: The IGMP message was from myself. Ignoring.
Wed Jul 27 21:04:56 2022 user.notice igmpproxy[10930]: RECV V2 member report   from 192.168.200.1   to 224.0.0.2
Wed Jul 27 21:04:56 2022 user.notice igmpproxy[10930]: The IGMP message was from myself. Ignoring.
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: About to call timeout 1 (#0)
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: Aging routes in table.
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]:
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: Current routing table (Age active routes):
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: -----------------------------------------------------
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: No routes in table...
Wed Jul 27 21:04:59 2022 user.debug igmpproxy[10930]: -----------------------------------------------------
Wed Jul 27 21:04:59 2022 user.notice igmpproxy[10930]: RECV V2 member report   from 192.168.200.1   to 224.0.0.22
Wed Jul 27 21:04:59 2022 user.notice igmpproxy[10930]: The IGMP message was from myself. Ignoring.

Am I going about this properly? Have I just screwed up the configuration?

0

2 Answers 2

1

You're going about this the wrong way, because IGMP is only for multicasts, not broadcasts. That heartbeat protocol should be using multicasts (or better yet, unicasts), not broadcasts. If you don't have the ability to fix the heartbeat protocol to properly use multicasts (or again, unicasts preferably), then you'll need to find a different solution.

The igmpproxy package looks for IGMP messages that show that a device is trying to subscribe to a multicast traffic flow. igmpproxy uses those messages to learn which multicast streams it needs to proxy across the router. Broadcasts, as the name might imply, already always go to all devices without anyone having to subscribe to them. That means broadcasts don't need, or use, a mechanism like IGMP in order to make sure they're delivered to all hosts. Broadcasts are always delivered to all hosts no matter what.

0

Spiff's answer is indeed correct and most properly answers my question, but I've come up with a work-around that does exactly what I need. Unfortunately, I can't change the program because of backwards compatibility purposes, so the only changes I can make would be on the router itself. My solution is to have a python script that runs on the router on boot that listens to the broadcast and mirrors it on the other LAN. Here is the complete script (tested with Python 3.10.5):

#!/usr/bin/python

import socket

localPort   = 7001
bufferSize  = 5000
RobotLanSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #UDP
RobotLanSocket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
RobotLanSocket.bind(('192.168.200.1',0))
while(True):
    try:
        UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
        UDPServerSocket.bind(('', localPort))
        while(True):
            bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
            message = bytesAddressPair[0]
            address = bytesAddressPair[1]
            clientMsg = "Message from Client:{}".format(message)
            clientIP  = "Client IP Address:{}".format(address)
            RobotLanSocket.sendto(message, ("255.255.255.255", 7001))
    except Exception as e:
        print(str(e))

To get it to run on boot, I installed coreutils-nohup to avoid hangups when starting the script:

opkg update
opkg install coreutils-nohup

and added the following to the /etc/rc.local file:

/usr/bin/nohup /bin/broadcast-forwarder.py &
2
  • Did you still need igmpproxy and its configuration? Trying to do the same with different networks and ports, but having trouble getting the script to receive packets
    – ravemir
    Commented Nov 6, 2022 at 23:49
  • 1
    Nope. Just the script. I also had another script running for passing the traffice in the other direction. Really the same script, except for different IP's. Commented Nov 7, 2022 at 5:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .