alsmith / multicast-relay

Relay multicast and broadcast packets between interfaces.
GNU General Public License v3.0
304 stars 47 forks source link

Help for anyone moving to UDM Pro v2.4.23 #71

Open mojo333 opened 1 year ago

mojo333 commented 1 year ago

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.

lsiepel commented 1 year ago

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.

oyow commented 1 year ago

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?

mojo333 commented 1 year ago

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.

oyow commented 1 year ago

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

alsmith commented 1 year ago

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

oyow commented 1 year ago

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

alsmith commented 1 year ago

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
dbs179 commented 1 year ago

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

tkdrob commented 1 year ago

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.

ChimpRocket commented 1 year ago

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.

tkdrob commented 1 year ago

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.

ChimpRocket commented 1 year ago

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 👍

lsiepel commented 1 year ago

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.

tkdrob commented 1 year ago

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.

ChimpRocket commented 1 year ago

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.

mojo333 commented 1 year ago

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?

tkdrob commented 1 year ago

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.

alsmith commented 1 year ago

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...

johntdyer commented 8 months ago

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

alsmith commented 8 months ago

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

ChimpRocket commented 8 months ago

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

mojo333 commented 7 months ago

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

u20p17 commented 6 months ago

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)