Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How can I get this UDP relay package for casting across VLANs?

    Scheduled Pinned Locked Moved pfSense Packages
    123 Posts 21 Posters 49.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stephenw10S
      stephenw10 Netgate Administrator
      last edited by

      Ah, yes. Special IP. I agree, that's not a great choice. You can change that in the code, probably easier to live with it though.

      You can put the binary anywhere in the path. I would probably put it in /root at least initially so it doesn't get overwritten.

      Steve

      1 Reply Last reply Reply Quote 0
      • T
        tman222
        last edited by tman222

        @burntoc @stephenw10

        Just wanted to follow up quick and validate that this works great! Compiled the code to binary on FreeBSD 11.3, moved it over to pfSense, and then used the command from Steve above to autostart it using ShellCmd (replacing dev devices as needed with my own):

        /usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 5353 --dev igb2.60 --dev igb1.70 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
        

        Everything starts up fine after a firewall reboot and Google Home (Casting) and Apple TV (Airplay) work without issues. Avahi is no longer needed, plus there's the added bonus that Google Home speaker groups now work properly if the mobile device is in a different network subnet as the speakers / chromecasts.

        Thanks again guys! Hopefully this can be made into an official pfSense package soon.

        1 Reply Last reply Reply Quote 2
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          Nice!

          1 Reply Last reply Reply Quote 0
          • B
            burntoc
            last edited by

            @tman222 @stephenw10 Yeah, it's awesome. Glad you figured it out. I was planning to respond to you but I just saw your messages as I was going into some work meetings.

            B 1 Reply Last reply Reply Quote 0
            • B
              burntoc @burntoc
              last edited by

              @burntoc said in How can I get this UDP relay package for casting across VLANs?:

              @tman222 @stephenw10 Yeah, it's awesome. Glad you figured it out. I was planning to respond to you but I just saw your messages as I was going into some work meetings.

              Aaannnd......now it isn't working. It's odd, because I didn't change anything that I can see would affect this. I was tweaking a couple of DNS settings (not mDNS) and I noticed it shortly after, but even putting them back and checking that the relay is running it is no longer showing my groups in the other VLAN. I had stopped avahi because as you noted it was working fine without it, but even turning that back on hasn't fixed the issue. I'm not sure why it stopped, though there was an update to the Google Home app recently....

              1 Reply Last reply Reply Quote 0
              • B
                burntoc
                last edited by burntoc

                Actually that must be part of the issue. I just looked and the groups are still showing on my iPad, just not on my Android phone at the moment. Grrrr.....

                UPDATE - Nah, they show up but can't cast to those groups any longer unless I connect to that VLAN.

                1 Reply Last reply Reply Quote 0
                • T
                  tman222
                  last edited by

                  Hi @burntoc - everything is still working fine here. I just checked on an iPhone and it does have the latest version of the Google Home app installed. What changes did you make to DNS? Also have you tried resetting your firewall states to see if that helps (i.e. forcing all the connections to be reestablished)? Come to think of it, I did have a bit of trouble the other night after I created a new group and then couldn't cast to it. However, after a few more attempts it did eventually start working and has worked fine since.

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    tman222 @tman222
                    last edited by

                    @tman222 said in How can I get this UDP relay package for casting across VLANs?:

                    Hi @burntoc - everything is still working fine here. I just checked on an iPhone and it does have the latest version of the Google Home app installed. What changes did you make to DNS? Also have you tried resetting your firewall states to see if that helps (i.e. forcing all the connections to be reestablished)? Come to think of it, I did have a bit of trouble the other night after I created a new group and then couldn't cast to it. However, after a few more attempts it did eventually start working and has worked fine since.

                    Just wanted to follow up on my last post real quick to confirm that everything is working is still working fine on Android based device as well for me (using latest version of Google Home app).

                    @burntoc - were you ever able to resolve the issues you were seeing?

                    B 1 Reply Last reply Reply Quote 0
                    • B
                      burntoc @tman222
                      last edited by

                      @tman222 Thanks for following up - and confirming that your Android GH app is working okay. Mine is still not working well, though I've noticed that Home isn't working great in general atm (e.g. I ask it to play streams and they time out more often than not). I have one Google Home Hub in the IOT VLAN with my Chromecast audios, Google Home speakers, etc. and I wonder if something about the multicast address registration is not working properly. I've rebooted the firewall and the Google Home Hub but still no joy here. I'm pretty certain here weren't any other changes to my network. I have a couple of other things I probably have to prioritize above further troubleshooting, but worst case I'm planning on some troubleshooting no later than this weekend.

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        tman222 @burntoc
                        last edited by

                        @burntoc said in How can I get this UDP relay package for casting across VLANs?:

                        @tman222 Thanks for following up - and confirming that your Android GH app is working okay. Mine is still not working well, though I've noticed that Home isn't working great in general atm (e.g. I ask it to play streams and they time out more often than not). I have one Google Home Hub in the IOT VLAN with my Chromecast audios, Google Home speakers, etc. and I wonder if something about the multicast address registration is not working properly. I've rebooted the firewall and the Google Home Hub but still no joy here. I'm pretty certain here weren't any other changes to my network. I have a couple of other things I probably have to prioritize above further troubleshooting, but worst case I'm planning on some troubleshooting no later than this weekend.

                        @burntoc - did you change any settings on your wireless access points or network switches?

                        B 1 Reply Last reply Reply Quote 0
                        • B
                          burntoc @tman222
                          last edited by

                          @tman222 That's what I'm going to check, but I'm 99% sure I did not change any of that. I have 2 APs that trunk to the main switch, and I didn't mess with those APs, the trunks to the switch, or the trunk from the switch to the fireawall. No other mDNS or other changes, either.

                          1 Reply Last reply Reply Quote 0
                          • T
                            tman222
                            last edited by

                            Just wanted to follow up on this thread quick and mention that this is still tool is working great for me without any issues (despite several reboots of the firewall since the initial install and configuration). A great alternative to Avahi if one is looking to get Google Home speaker groups to work. Even though I have not been able to try this out yet, it may also be a suitable alternative for pimd to get Sonos speakers to work.

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              tman222 @tman222
                              last edited by tman222

                              UPDATE 5/25/2023:

                              As of pfSense Plus 23.05, udpbroadcastrelay is now a formal pfSense package that can be added via the Package Manager.

                              =====================

                              Just thought I would provide a quick set of instructions to get this package up and going (questions were asked in another thread).

                              README FIRST:

                              1. Instructions on how to configure the package can be found on the creator's page on GitHub:

                              https://github.com/marjohn56/udpbroadcastrelay

                              1. Before proceeding always make a backup of your firewall configuration first in case a mistake/misconfiguration renders your system inoperable.

                              INSTRUCTIONS - Please Read Updates Below As Well:

                              1. Compile the updbroadcastrelay code from GitHub (see @stephenw10's post above for reference: https://forum.netgate.com/topic/155698/how-can-i-get-this-udp-relay-package-for-casting-across-vlans/9) on a FreeBSD system or virtual machine (For pfSense 2.4.5p1 this should be FreeBSD 11.3). If you are not able to compile the code on your own, you can also download the attached archive file which contains a precompiled udpbroadcastrelay binary. Please note that this binary has been compiled under FreeBSD 11.3 and thus only tested to work with the current version of pfSense (at the time of this writing this is 2.4.5-p1).

                              udpbroadcastrelay_pfSense245p1.zip

                              UPDATE 2/18/2021:

                              With pfSense 2.5.0 now being available, @sfxdude has compiled the udpbroadcastrelay code to binary under FreeBSD 12.2 for pfSense 2.5.0. Please see this post:

                              https://forum.netgate.com/topic/155698/how-can-i-get-this-udp-relay-package-for-casting-across-vlans/59

                              UPDATE 3/14/2021:
                              It looks like this package has now been included upstream in FreeBSD, so no longer a need to compile on your own from source:

                              https://www.freshports.org/net/udpbroadcastrelay/
                              https://forum.netgate.com/topic/155698/how-can-i-get-this-udp-relay-package-for-casting-across-vlans/66

                              1. Next, drop the compiled udpbroadcastrelay binary file into the /root/udpbroadcastrelay directory on your firewall.

                              2. Install the ShellCmd package on pfSense.

                              3. Configure the updbroadcastrelay based on your use case and configure the ShellCmd package to start it automatically on startup. Please see:

                              https://github.com/marjohn56/udpbroadcastrelay#usage

                              Below are two example commands to illustrate using the package to enable mDNS relaying between two network interfaces, igb0 and igb1:

                              /usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 5353 --dev igb0 --dev igb1 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
                              

                              If using two VLAN's, e.g. 10 and 20:

                              /usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 5353 --dev igb0.10 --dev igb1.20 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
                              

                              Additional details are also available further up on this thread.

                              1. Although I have not tried this out, I assume it would be ok to run multiple instances of the udpbroadcastrelay (with different --id defined) in case you want to enable mDNS and SSDP at the same time, for example.

                              2. This only sets up the udp relaying between subnets. The necessary firewall rules are still required for devices on different subnets to actually talk to each other (once they have been discovered).

                              ======================

                              I hope these instructions are useful for those looking to try this out. Please note that I'm not the creator and maintainer of this code base so will be limited with the amount of help I can provide.

                              S 1 Reply Last reply Reply Quote 8
                              • S
                                sinbox_pfs @tman222
                                last edited by

                                @tman222 x-posting my reply from the other thread with some observations from my end.

                                “@tman222 thank you.

                                I ended up spinning a VM on a old Windows laptop and was able to get the binary working. It works like a charm! Great thing is that it doesn’t need any other packages like Avahi or PIMD ( I never had any 100% success with previously) nor does it require fiddling around with firewall rules. For the first time in 2 years, I have my Sonos working as I intend in my pfSense + Unifi ecosystem.

                                So far, I have the following tested and working correctly:

                                Controlling and playing to Sonos speakers across VLANs via the Sonos App v2
                                Airplay 2 (incl multi-room) works perfectly across VLANS.
                                LIFX app to manage bulbs across VLAN’s works great
                                Side effect - HomeKit also works across VLANs although I have only tested with anything else other than the LIFX bulbs. Now that I have my IoT network in working order, I feel like investing in more devices.
                                I just need to figure out a reliable way to keep the package running if/when pfSense reboots (eg via shellcmd).

                                @tman222 Do you use Cloudflare DNS? Not sure I understand what the hard coded 1.1.1.1 source address in the package does? So far I’m not seeing any conflicts with their DNS, but will keep an eye out if anything breaks.”

                                Re:#5: Yes, I can confirm multiple instances of the process with a unique ID works. That’s how I have it running,

                                #6: Agree - this will be unique to everyone’s case based on their VLAN configuration, but in my instance, I only have one rule alllowing all traffic from My LAN to any. Does this open up any security risks?

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  From the man page:

                                  A special source ip of -s 1.1.1.1 can be used to set the source ip to the address of the outgoing interface and the source UDP port to the same as the destination port. '-s 1.1.1.2' does the same but leaves the UDP ports unchanged. These values are notably required to cater for the Chromecast system.
                                  

                                  Steve

                                  QinnQ 1 Reply Last reply Reply Quote 0
                                  • QinnQ
                                    Qinn
                                    last edited by

                                    @stephenw10 said in How can I get this UDP relay package for casting across VLANs?:

                                    ./udpbroadcastrelay

                                    Maybe I missed it, but what is the command to quit/stop/kill it?

                                    Hardeware: Intel(R) Celeron(R) J4125 CPU @ 2.00GHz 102 GB mSATA SSD (ZFS)
                                    Firmware: Latest-stable-pfSense CE (amd64)
                                    Packages: pfBlockerNG devel-beta (beta tester) - Avahi - Notes - Ntopng - PIMD/udpbroadcastrelay - Service Watchdog - System Patches

                                    T 1 Reply Last reply Reply Quote 0
                                    • T
                                      tman222 @Qinn
                                      last edited by tman222

                                      @Qinn said in How can I get this UDP relay package for casting across VLANs?:

                                      @stephenw10 said in How can I get this UDP relay package for casting across VLANs?:

                                      ./udpbroadcastrelay

                                      Maybe I missed it, but what is the command to quit/stop/kill it?

                                      Hi @Qinn - I've had no trouble terminating / stopping the udpbroadcastrelay process just using the kill command, i.e. if process id (PID) is 12345, then I would issue the following from the shell: kill 12345

                                      https://www.freebsd.org/cgi/man.cgi?query=kill&apropos=0&sektion=1&manpath=FreeBSD+11.3-RELEASE

                                      Hope this helps.

                                      QinnQ 1 Reply Last reply Reply Quote 1
                                      • QinnQ
                                        Qinn @tman222
                                        last edited by Qinn

                                        @tman222 said in How can I get this UDP relay package for casting across VLANs?:

                                        @Qinn said in How can I get this UDP relay package for casting across VLANs?:

                                        @stephenw10 said in How can I get this UDP relay package for casting across VLANs?:

                                        ./udpbroadcastrelay

                                        Maybe I missed it, but what is the command to quit/stop/kill it?

                                        Hi @Qinn - I've had no trouble terminating / stopping the udpbroadcastrelay process just using the kill command, i.e. if process id (PID) is 12345, then I would issue the following from the shell: kill 12345

                                        https://www.freebsd.org/cgi/man.cgi?query=kill&apropos=0&sektion=1&manpath=FreeBSD+11.3-RELEASE

                                        Hope this helps.

                                        Thanks for your quick reply! I know of the kill command, just don't understand that the developer did not add a quit/stop option for it's users for this service. So I hoped I missed it in the syntax, but apparently it's not there.

                                        It's seems to be an OPNsense package/Plugin with a GUI which has the start and stop https://forum.opnsense.org/index.php?topic=15910.0

                                        For anyone who needs it:

                                        How to kill the udpbroadcastrelay service

                                        PS
                                        

                                        this will give you the process ID (PID)

                                        PID     TT  STAT    TIME     COMMAND
                                        
                                        38231  0-     S      0:00.36 ./udpbroadcastrelay --id 2 --port 1900 --dev 
                                        

                                        then use the kill command

                                        kill 38231
                                        

                                        Hardeware: Intel(R) Celeron(R) J4125 CPU @ 2.00GHz 102 GB mSATA SSD (ZFS)
                                        Firmware: Latest-stable-pfSense CE (amd64)
                                        Packages: pfBlockerNG devel-beta (beta tester) - Avahi - Notes - Ntopng - PIMD/udpbroadcastrelay - Service Watchdog - System Patches

                                        1 Reply Last reply Reply Quote 0
                                        • QinnQ
                                          Qinn @stephenw10
                                          last edited by Qinn

                                          @stephenw10 said in How can I get this UDP relay package for casting across VLANs?:

                                          From the man page:

                                          A special source ip of -s 1.1.1.1 can be used to set the source ip to the address of the outgoing interface and the source UDP port to the same as the destination port. '-s 1.1.1.2' does the same but leaves the UDP ports unchanged. These values are notably required to cater for the Chromecast system.
                                          

                                          Steve

                                          Could udpbroadcastrelay be implemented as a GUI, must say it's rather a simple and elegant tool compared to PIMD

                                          Hardeware: Intel(R) Celeron(R) J4125 CPU @ 2.00GHz 102 GB mSATA SSD (ZFS)
                                          Firmware: Latest-stable-pfSense CE (amd64)
                                          Packages: pfBlockerNG devel-beta (beta tester) - Avahi - Notes - Ntopng - PIMD/udpbroadcastrelay - Service Watchdog - System Patches

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S
                                            stephenw10 Netgate Administrator
                                            last edited by

                                            The feature request is open, add your comments there:
                                            https://redmine.pfsense.org/issues/10818

                                            It's certainly relatively simple. There is a fine line between elegant and crude. 😉

                                            Hard to argue with what works though.

                                            Steve

                                            QinnQ 1 Reply Last reply Reply Quote 3
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.