How can I get this UDP relay package for casting across VLANs?
-
I expect either:
/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
Or don't bother with sending output anywhere and just use:
/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
But try killing the process after it boots. The other services will then start if that is what you're hitting.
Steve
-
I actually tried the second command you provided first, as I don't really need the output and it hung the services. As you suggested, killing it then allowed the services to start.
I tried one last time with the first command - and it looks like it may have worked! I'm not going to get another chance to reboot for a bit to test again, but I am optimistic enough to say thank you for your help with this. I'm not sure why it was hanging it, but it seems this approach may have addressed it.
-
I snuck in a reboot while I had a moment and I can confirm it is working with the first command you provided. Thanks again, Steve.
-
Nice!
Let us know how that goes. You might open a feature request in redmine to create a package for it if it performs well.
Steve
-
@stephenw10 It's still going great, and I submitted the request:
https://redmine.pfsense.org/issues/10818
-
Hi all,
This is an interesting thread - I had a couple questions:
-
Any particular reason 1.1.1.1 is used as the source IP instead of an IP address on the subnet that contains the chromecasts?
-
Can the UDP broadcast relay code also be compiled on pfSense or is a separate install of FreeBSD 11.3 required?
Thanks in advance.
-
-
Unclear why 1.1.1.1 is used there. It could just be an example IP.
Yes you need a separate FreeBSD install to compile it. There are no build tools in pfSense.
https://docs.netgate.com/pfsense/en/latest/development/compiling-software-on-the-firewall.htmlSteve
-
@stephenw10 said in How can I get this UDP relay package for casting across VLANs?:
Unclear why 1.1.1.1 is used there. It could just be an example IP.
Yes you need a separate FreeBSD install to compile it. There are no build tools in pfSense.
https://docs.netgate.com/pfsense/en/latest/development/compiling-software-on-the-firewall.htmlSteve
Thanks @stephenw10 ! Regarding 1.1.1.1, looks like it's all explained here (should have read a bit closer):
https://github.com/marjohn56/udpbroadcastrelay#udp-broadcast-relay-for-linux--freebsd--pfsense--opnsense
I just wish they had used a different address than 1.1.1.1 since that's also the IP of Cloudflare's DNS -- makes it a bit confusing.
Once the code has been compiled, is there a recommended location (directory) to put the binary on pfSense?
Thanks again!
-
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
-
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.
-
Nice!
-
@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.
-
@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....
-
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.
-
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.
-
@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?
-
@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 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?
-
@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.
-
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.
-
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:
- Instructions on how to configure the package can be found on the creator's page on GitHub:
https://github.com/marjohn56/udpbroadcastrelay
- 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:
- 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:
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-
Next, drop the compiled udpbroadcastrelay binary file into the /root/udpbroadcastrelay directory on your firewall.
-
Install the ShellCmd package on pfSense.
-
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.
-
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. -
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.
-
@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?
-
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
-
@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?
-
@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) is12345
, 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.
-
@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) is12345
, 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
-
@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
-
The feature request is open, add your comments there:
https://redmine.pfsense.org/issues/10818It's certainly relatively simple. There is a fine line between elegant and crude.
Hard to argue with what works though.
Steve
-
@stephenw10 Nice
-
@tman222 said in How can I get this UDP relay package for casting across VLANs?:
/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
I know what the nohup is for, just don't understand why the nohup in needed as nohup implies that the executed command can/may survive past logout. I tested
/root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 5353 --dev igb0 --dev igb1 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
and updbroadcastrelay stayed up after I logged out as root.
Or has it something to with Shellcmd or did I miss something else ?
-
I would normally use it with a shellcmd. I have seen commands run there fail at the end of boot otherwise.
Though since that's expected to run as a service it may not be required.
Steve
-
Aha so it's shellcmd related
-
So in my journey to make sonos work from across Vlans i came to this thread .
I have made some progress :
i created an Ubuntu VM on my server and gave it 2 interfaces one with a trusted network and the other one with the Vlan network.
I think i compiled the program correctly here is the command i ran :
sudo ./udpbroadcastrelay --id 1 --port 5353 --dev enp1s0 --dev enp3s0 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
But it threw an error.
bind: Address already in use
I have no experience at all when it comes to linux.
I hope someone can guide me .
-
@shremi said in How can I get this UDP relay package for casting across VLANs?:
So in my journey to make sonos work from across Vlans i came to this thread .
I have made some progress :
i created an Ubuntu VM on my server and gave it 2 interfaces one with a trusted network and the other one with the Vlan network.
I think i compiled the program correctly here is the command i ran :
sudo ./udpbroadcastrelay --id 1 --port 5353 --dev enp1s0 --dev enp3s0 --multicast 224.0.0.251 -s 1.1.1.1 -f > /dev/null
But it threw an error.
bind: Address already in use
I have no experience at all when it comes to linux.
I hope someone can guide me .
Hi @shremi - have you checked to see whether no other program / service in Ubuntu might already be using the multicast address? Beyond that though, is there any particular reason you are trying to use this tool on Linux vs. directly on pfSense? Hope this helps.
-
Thanks @tman222 i was just trying to see if that works and then move it to the pfsense machine.
I made it work it was the avahi daemon runing on the linux VM .... but as soon as i killed that service and opened 5353 for mdns everything on the network went bezerk ...
I mostly run home assistant to get everything centralized and it threw a lot of errors stating that there was another instance of home assistant running with the same name ..... so back to square one i can either create another VM on the server with a freebsd OS or move it directly to the firewall itself.
What made me hesitant to install it on the firewall is :
- that i really don't know how to access the /root/ folder or how can i copy the file to it.
- and how do i make the package to autostart on boot-up
- i also don't know if should delete the avahi package
I have a couple of free days since a relative tested positive for Covid and we are just being careful our test came back negative .
-
@shremi said in How can I get this UDP relay package for casting across VLANs?:
-
- that i really don't know how to access the /root/ folder or how can i*
@shremi I guess you are a Windows man ;) Install WinSCP and use de scp protocol on port 22 and login to pfSense
make a directory in /root named udpbroadcastrelay
copy the udpbroadcastrelay file to this directory
Now you have to make udpbroadcastrelay executable
use properties on the file in WinSCP to change it to 0755 or use telnet to do this manually withchmod 755 udpbroadcastrelay
You picked the wrong startup command for Sonos devices you do not need --multicast 224.0.0.251 but --multicast 239.255.255.250 see below
-
- i and how do i make the package to autostart on boot*
Install the Shellcmd package from the package manager in pfSense
use this command in Shellcmd with of course your vlans/usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 1900 --dev igb1.10 --dev igb1.20 --multicast 239.255.255.250 -f > /dev/null
-
- i also don't know if should delete the avahi package*
You can leave it installed
-
-
@Qinn said in How can I get this UDP relay package for casting across VLANs?:
/usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 1900 --dev igb1.10 --dev igb1.20 --multicast 239.255.255.250 -f > /dev/null
Thanks a lot fo this @QINN i really appreciate it. Yeah i am lost when it comes to linux-freebsd :(
So here is where i am at :
I followed the instructions correctly as you stated. how can i verify that it is working. ???
Im guessing i need to open some sort of connection to a command line to input the cmd commands in the firewall?
Heres what i did :
I went to services and then to shellcmd and created this command.
/usr/bin/nohup /root/udpbroadcastrelay/./udpbroadcastrelay --id 1 --port 1900 --dev igb0 --dev igb0.40 --multicast 239.255.255.250 -f > /dev/null
I am using LAN and VLAN 40 on the same igb0 port i think that should work right?
i created an alias for the sonos stuff and then created a rule on the IoT vlan to for the sonos alias to talk to the private network.
But still no connection via the app.
I am sure i am missing something.
-
@shremi 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?:
I am sure i am missing something.
Yeah quoting myself hahahaha !!
Thanks a lot i think i just needed to reboot the pfsense machine i can discover and talk to sonos devices from my private network.
I am going to tight down the aliases instead of giving the sonos players full access to the main trusted network. i will give it to the phones and home assistant VM.
The only thing that it seems that stopped working is the UPnP Service for pfsense i used to have it for the consoles but i dont think that they are in use .
Next up i would like to use this for mDNS and get rid of avahi since i read that using this option has a little bit of more advantages over the avahi package.
-
@shremi You can see it running from the command line, best is to login using putty with SSH or when you have installed WinSCP press Control T and a terminal will open. Here you enter the ps command (processes status)
ps
You will get something like
/root/udpbroadcastrelay$ ps PID TT STAT TIME COMMAND 28327 u0- SN 14:19.50 /bin/sh /var/db/rrd/updaterrd.sh 73155 u0 Is 0:00.02 login [pam] (login) 73672 u0 I 0:00.02 -sh (sh) 90155 u0 I+ 0:00.01 /bin/sh /etc/rc.initial 71121 v0 Is 0:00.02 login [pam] (login) 73887 v0 I 0:00.02 -sh (sh) 75937 v0 I+ 0:00.01 /bin/sh /etc/rc.initial 71448 v1 Is+ 0:00.01 /usr/libexec/getty Pc ttyv1 71544 v2 Is+ 0:00.01 /usr/libexec/getty Pc ttyv2 71638 v3 Is+ 0:00.01 /usr/libexec/getty Pc ttyv3 71836 v4 Is+ 0:00.01 /usr/libexec/getty Pc ttyv4 72169 v5 Is+ 0:00.01 /usr/libexec/getty Pc ttyv5 72465 v6 Is+ 0:00.01 /usr/libexec/getty Pc ttyv6 72832 v7 Is+ 0:00.01 /usr/libexec/getty Pc ttyv7 50749 0 S 0:00.00 ./udpbroadcastrelay --id 1 --port 1900 --dev igb1.1005 82781 0 Is 0:00.01 -sh (sh) 83059 0 I 0:00.01 /bin/sh /etc/rc.initial 85940 0 S+ 0:00.07 /bin/tcsh
Btw Using the commandline I would always advise to install putty https://www.putty.org/
-
first enable SSH in pfSense -> System /Advanced/Admin Access
-
Then install putty https://www.putty.org/ and enable SSH in pfSense and login with SSH
-
-
Thanks, this help me to get working control of my devices between VLANs.