multicast-relay icon indicating copy to clipboard operation
multicast-relay copied to clipboard

Help for anyone moving to UDM Pro v2.4.23

Open mojo333 opened this issue 2 years ago • 23 comments

Not an issue, but help for anyone moving over to the podman-less version of the UDM OS. You can easily get this up and running without containers as Python v3.5.3 is already installed by default.

Once you've downloaded multicast-relay.py to your UDM Pro, run as follows:

/usr/bin/python3 /data/multicast-relay/multicast-relay.py --interfaces brX brY brZ --noMDNS

where brX, brY etc are the interfaces you want to multicast. Obviously you can also pass parameters such as --noMDNS etc as you see fit.

I have also setup on_boot.d by using a slightly modified version from here: https://di-marco.net/blog/it/2022-01-22-unchain_the_udm_pro_se/. Modified in that I edited the script to point to "/data" instead of the old "/mnt/data" which doesn't exist anymore.

Alternatively, you can also follow the instructions to install podman (being mindful of using /data and not /mnt/data) but it'd be a complete pain to re-setup every time there was an UDM upgrade so I wanted to move away from that.

mojo333 avatar Dec 18 '22 10:12 mojo333

Not an issue, but help for anyone moving over to the podman-less version of the UDM OS. You can easily get this up and running without containers as Python v3.5.3 is already installed by default.

Once you've downloaded multicast-relay.py to your UDM Pro, run as follows:

/usr/bin/python3 /data/multicast-relay/multicast-relay.py --interfaces brX brY brZ --noMDNS

where brX, brY etc are the interfaces you want to multicast. Obviously you can also pass parameters such as --noMDNS etc as you see fit.

I have also setup on_boot.d by using a slightly modified version from here: https://di-marco.net/blog/it/2022-01-22-unchain_the_udm_pro_se/. Modified in that I edited the script to point to "/data" instead of the old "/mnt/data" which doesn't exist anymore.

Alternatively, you can also follow the instructions to install podman (being mindful of using /data and not /mnt/data) but it'd be a complete pain to re-setup every time there was an UDM upgrade so I wanted to move away from that.

Exactly why i use this tool. Really hope UI will add the multicast relay function to it's base services. Anyway, i use it on a seperate box, but if i understand it right, this on_boot.d method survives reboots and psisbly also updates?! That would remove a dependency on that extra box.

lsiepel avatar Dec 22 '22 18:12 lsiepel

I have multicast-relay.py copied to basically the same path but I am getting permission denied when trying to run. I'm in as root? The readme says to install 'netifaces' package. Is that already on UDM-SE?

oyow avatar Jan 12 '23 03:01 oyow

What's the exact error you're seeing?

I can't speak for the UDM-SE as I have a UDM-PRO running v2.4.23 but I didn't need to install any packages in order for this to work.

mojo333 avatar Jan 12 '23 09:01 mojo333

In addition to UDM-SE this is also on v3.0.13 so maybe they changed something

root@UDM-SE:~# "/usr/bin/python3 /data/multicast-relay/multicast-relay.py" --interfaces br0 br10 br20 --noMDNS -bash: /usr/bin/python3 /data/multicast-relay/multicast-relay.py: Permission denied

oyow avatar Jan 12 '23 13:01 oyow

Remove the double quotes and that might get you a bit further.

alsmith avatar Jan 12 '23 14:01 alsmith

No change. I didn't have a python3 folder in /usr/bin so I created it. From the examples it looks like there's a space after python3. Thinking that mattered I kept it and used the quotes. But no dice

oyow avatar Jan 13 '23 00:01 oyow

Ah it is a problem if you don't have python3 - it needs to be an executable, so you ought to remove the directory. The quotes are definitely a problem though: they should not be used.

You might be able to use something like this to install python:

unify-os shell
apt-get update
apt-get install python3

alsmith avatar Jan 13 '23 07:01 alsmith

Not an issue, but help for anyone moving over to the podman-less version of the UDM OS. You can easily get this up and running without containers as Python v3.5.3 is already installed by default.

Once you've downloaded multicast-relay.py to your UDM Pro, run as follows:

/usr/bin/python3 /data/multicast-relay/multicast-relay.py --interfaces brX brY brZ --noMDNS

where brX, brY etc are the interfaces you want to multicast. Obviously you can also pass parameters such as --noMDNS etc as you see fit.

I have also setup on_boot.d by using a slightly modified version from here: https://di-marco.net/blog/it/2022-01-22-unchain_the_udm_pro_se/. Modified in that I edited the script to point to "/data" instead of the old "/mnt/data" which doesn't exist anymore.

Alternatively, you can also follow the instructions to install podman (being mindful of using /data and not /mnt/data) but it'd be a complete pain to re-setup every time there was an UDM upgrade so I wanted to move away from that.

Any chance you can write an idiots guide to this? I'm super familiar with running it in the containerized version, but not sure how to copy the .py file to my UDM Pro. I just moved to 2.4.27 so this is super helpful!

UPDATE: I was able to figure this out. Here are my instructions for anyone that isn't savvy enough to just get it right away.

UDM Pro Multicast Relay on Unifi OS 2.4.27

Logging on: Open Putty and select UDM Pro Enter Username: root Enter Password: SSH Password

Changing Directory: In Putty enter this command: cd /data

Create Multicast-Relay Folder: In Putty enter this command: mkdir multicast-relay

Changing Directory: In Putty enter this command: cd /data/multicast-relay

Download multicast-relay.py file: In Putty enter this command: curl https://raw.githubusercontent.com/alsmith/multicast-relay/master/multicast-relay.py -o multicast-relay.py

Changing Directory: In Putty enter this command: cd /usr/bin

Run the Multicast Relay: In Putty enter this command: python3 /data/multicast-relay/multicast-relay.py --interfaces br0 br10 br20 --noMDNS

dbs179 avatar Jan 31 '23 16:01 dbs179

I have UDM Pro on Early Access. The script works in connecting my phone to Sonos across VLANs but only for a couple minutes before I have to restart the script. I am not sure what causes this other than time.

tkdrob avatar Apr 01 '23 21:04 tkdrob

I have UDM Pro on Early Access. The script works in connecting my phone to Sonos across VLANs but only for a couple minutes before I have to restart the script. I am not sure what causes this other than time.

I'm also on UDMP early access. In my case the script runs fine and I can tail the verbose log and see it doing its stuff. But for me, the Sonos part never works and I never got it working in the podman days or on various versions on UDMP. I'm thinking it must be something in my UDM config but I've pretty much tried everything and got nowhere! Does anyone have a listed of settings that are required in the UDM networks?

In the end, I resorted to using an old iPhone that sits in the same VLAN as Sonos! But I'd love to get the mcast relay working instead.

Thanks.

ChimpRocket avatar May 11 '23 16:05 ChimpRocket

At least for me, Sonos uses an extra mDNS address. What got this working for me was to add --relay 255.255.255.255:1900 to the command.

tkdrob avatar May 11 '23 17:05 tkdrob

At least for me, Sonos uses an extra mDNS address. What got this working for me was to add --relay 255.255.255.255:1900 to the command.

Absolute genius! :-) That worked right away for me with no other changes required. Clearly I should've spent more time studying these protocols and analysing my pcaps! Many thanks for that precious nugget of info 👍

ChimpRocket avatar May 12 '23 08:05 ChimpRocket

Does this work for UDMP 3.0.20 ? I might move my solution from a seperate box to UDMP. Hopefully UI will fix their mDNS so it will be possible to relay this natively.

lsiepel avatar May 12 '23 08:05 lsiepel

I am on early release and it works. Just know that you will have to make it run at startup. There are guides out there to make it do that.

tkdrob avatar May 12 '23 10:05 tkdrob

Does this work for UDMP 3.0.20 ? I might move my solution from a seperate box to UDMP. Hopefully UI will fix their mDNS so it will be possible to relay this natively.

Yes, I'm running the same version and it works with the fix tkdrob posted above. I'm running several scripts at startup using the di-marco.net method at the top of this thread.

ChimpRocket avatar May 12 '23 11:05 ChimpRocket

At least for me, Sonos uses an extra mDNS address. What got this working for me was to add --relay 255.255.255.255:1900 to the command.

@alsmith any chance you can add this into the core code?

mojo333 avatar May 12 '23 11:05 mojo333

It can easily be added but it falls under mDNS and not SSDP. Sonos uses both. I am not sure how @alsmith wants to classify it.

Not everyone would need or want that extra mDNS address.

tkdrob avatar May 12 '23 11:05 tkdrob

At least for me, Sonos uses an extra mDNS address. What got this working for me was to add --relay 255.255.255.255:1900 to the command.

@alsmith any chance you can add this into the core code?

Consider it done...

alsmith avatar May 12 '23 12:05 alsmith

So if we're running this should any of the multicast / IGMP configs be set on the unifi device itself? Worried about potential conflicts

johntdyer avatar Oct 27 '23 16:10 johntdyer

Did anyone figure out if the UniFi multicast option needs to be enabled or disabled? Or if it even matters either way ?

alsmith avatar Oct 30 '23 12:10 alsmith

I have 'IGMP Snooping' and 'Multicast DNS' enabled on the SONOS speaker and SONOS client networks. Doesn't conflict with this mcast relay.

ChimpRocket avatar Nov 01 '23 14:11 ChimpRocket

As long as you have --noMDNS then you will be fine having multicast DNS enabled on Unifi.

mojo333 avatar Nov 02 '23 21:11 mojo333

Hi, I just tried the script with the following commands:

cd /tmp
wget https://github.com/alsmith/multicast-relay/raw/master/multicast-relay.py
python3 multicast-relay.py --foreground --verbose --noMDNS --interfaces br40 br0

Everything seems to work with my sonos speakers. But how can I put the script in 'autostart' of the UDM-SE that it starts running again after reboots/firmware updates? Thanks!

EDIT: is this the way to go? (I have OS3.2.7 installed) https://github.com/unifi-utilities/unifios-utilities/tree/main/on-boot-script-2.x

EDIT2: did it via 'systemd' (Y)

u20p17 avatar Dec 18 '23 11:12 u20p17