OPNsense Forum

Archive => 19.7 Legacy Series => Topic started by: nivek1612 on December 28, 2019, 12:31:56 pm

Title: [Solved] Sonos on VLANS
Post by: nivek1612 on December 28, 2019, 12:31:56 pm
So I'm almost there in getting Sonos on a separate VLAN to be controllable via the iPhone app on another VLAN

I found this article https://forum.netgate.com/topic/139218/sonos-speakers-and-applications-on-different-subnets-vlan-s

yes I know its from the darkside

But my only issue is I can only get it to work when I run it in debug mode ie I start pmid with the -d parameter which means it runs in the foreground on the console and fills it with diagnostics messages

Anyone managed to get it working ?

Title: Re: Sonos on VLANS - PIMD
Post by: mimugmail on December 28, 2019, 02:12:11 pm
You mean it only works in debug? Does this make sense?
Title: Re: Sonos on VLANS - PIMD
Post by: nivek1612 on December 28, 2019, 02:17:47 pm
Yes if I start pmid from the cmd line with
pmid -d - c /usr/local/etc/pmid.conf

Then it works as expected and I’m able to access my Sonos on one vlan from another vlan
 -d is debug parameter - c is conf file location

But
pmid -c /usr/local/etc/pmid.conf shows it’s started in the logs but no other messages and I’m unable to access Sonos
Title: Re: Sonos on VLANS - PIMD
Post by: mimugmail on December 28, 2019, 03:14:46 pm
Can you try -f instead of -d and look for errors?
Title: Re: Sonos on VLANS - PIMD
Post by: nivek1612 on December 28, 2019, 08:11:56 pm
Now that interesting because using -f instead of -d also works

So now I'm suspecting pimd just doesn't like being run in the background

Would making PIMD a plugin get around that ?

Title: Re: Sonos on VLANS - PIMD
Post by: mimugmail on December 28, 2019, 08:37:37 pm
Isnt there a rc Script to handle this correctly?

/usr/local/etc/rc.d/pimd onestart
Title: Re: Sonos on VLANS - PIMD
Post by: nivek1612 on December 28, 2019, 11:45:17 pm
Yes there is and I missed that completely

Added a file pmid to /etc/rc.conf.d with the line
pmid_enabled="YES"

Now it is running after a reboot and all is working perfectly

Thanks for the quick guidance, as always the support on this forum is just first class.

I guess the only downside of this approach is having to reconfigure post upgrades as I assume the conf files will be overwritten 
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: mimugmail on December 29, 2019, 06:28:02 am
Can you post your config so I can build a plugin for it?
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on December 29, 2019, 09:50:31 am
Sure not sure what level of detail you want so here goes

I run the following VLANs

1 - Trusted devices
10 - TV (set top boxes and TVs)
20 - IP cameras 
30 - IOT (Sonos, Alexa, home automation)
1003 - Guest Wi-Fi

I want to be able to control Sonos on VLAN 30 from VLAN 1

Installed the pimd package

#pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/All/pimd-2.3.2.txz

By default pimd runs on all interfaces so I edited  /usr/local/etc/pimd.conf to disable those I’m not interested in

phyint pppoe0 disable
phyint igb1_vlan1003 disable
phyint igb1_vlan10 disable
phyint igb1_vlan20 disable
phyint ovpns1 disable

Now to ensure pimd starts after a reboot

create /etc/rc.conf.d/pimd
which contains one line
 
pimd_enable="YES"

I have my firewall rules open at the minute between VLANs until I got this working but I'm now about to start restricting them just to the Sonos ports
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: mimugmail on December 29, 2019, 10:13:07 am
This seems to be easy ...
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on December 29, 2019, 10:22:00 am
Lol .... well you did catch my mistakes quickly
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on December 31, 2019, 11:39:05 am
HI, @mimugamail do you need anything else from me for the plugin creation ?
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: mimugmail on December 31, 2019, 12:07:18 pm
No .. but this will be after 20.1 (if it will) .. :)
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on December 31, 2019, 12:32:53 pm
cool I have it manually installed on 20.1.b_32 and I'm happy to keep a manual install until/if the plugin appears

Would be nice to have something that is running on my firewall as an official plugin though :-)
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: JasMan on December 31, 2019, 02:14:50 pm
I've messed around with exactly the same things in the last days.
And I was so happy when I found this thread. :-)

I would be happy too when the PIMD would become an official plugin for OPNsense.

BTW: There's a typo. The file /etc/rc.conf.d/pimd must contain "enable" and not "enabled"
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on December 31, 2019, 02:31:28 pm
Good catch - just amended the post incase others read it later
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: fluxc on January 04, 2020, 10:56:41 am
I also configured my opnsense box for multicast streaming over VLANs some days ago. The goal was to make a DLNA server (minidlna) in one VLAN discoverable and available to clients in a different VLAN.

At first I tried using igmp-proxy. The problem is that it ignores site-local multicasting and therefore does not forward those packets upstream (see https://github.com/pali/igmpproxy/blob/d755b5b6327982434b87d631e089099dfd9a2ab4/src/igmp.c#L124).

After installing pimd it worked without having to configure anything. I tried to build the package myself but due to limited time ended up installing it from https://pkg.hardenedbsd.org/HardenedBSD/pkg/FreeBSD:11:amd64/All/pimd-2.3.2.txz.

Things to note:



It would be great if pimd would be made available as an official plugin since igmp-proxy seems not to be working for inter-VLAN service discovery (SSDP / DLNA etc.).
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: marjohn56 on January 06, 2020, 01:18:01 pm
Can you post your config so I can build a plugin for it?


Bin the plugin for this one Michael - we've found something better. Works with Sonos and Sky Q.


https://github.com/sonicsnes/udp-broadcast-relay-redux (https://github.com/sonicsnes/udp-broadcast-relay-redux)


I'm going to attempt to create a plugin, might take me a while and I'll probably be asking for help.  :)
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on January 06, 2020, 01:22:45 pm
Yes confirmed this one allows both Sonos and SkyQ to work together which PIMD didn't seem to handle
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: szty0pa on January 06, 2020, 01:39:40 pm
Wow, I am playing with this for the last few weeks as well. All inputs and possible plugins are very much appreciated! :)
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: marjohn56 on January 07, 2020, 10:36:28 am
It's very easy to set up. If you pull down that repo, compile it. There are instructions on how to install it and where to put the .conf and .sh files. We didn't take that path, just compiled it and dropped it into /usr/sbin, then we used Monit to fire it up and keep it going. Works very well.


If you get stuck, shout, and I'll post the way we did it.



Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: skywalker007 on January 07, 2020, 10:47:41 am
Hmm. You Guys lost me now.
I am running IGMP proxy at the moment for Deutsche Telekom Magenta TV which works well. I assumed I cannot run PIMD in parallel. Not sure if udp-broadcast-relay-redux can. Would it be cable to handle all multicast relaying that the IGMP proxy currently does?

thanks!
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: marjohn56 on January 07, 2020, 10:58:59 am
Only one way to find out....try it.


We used it because of the TTL=1 issue. When installed Nivek1612 found he no longer needed PIMD for his Sonos.


Here's a little excerpt from the doc that's in the archive.


Quote
However, the udp-broadcast-relay-redux tool allows arbitrary relaying of UDP packets between interfaces, and this helps to solve the problem.
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: skywalker007 on January 07, 2020, 10:26:15 pm
could someone please share a binary of it? I don't have a compiler on my firewall. TIA!
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: marjohn56 on January 07, 2020, 11:27:33 pm
Here you go. There's an .md file in there that explains how to install it on pfSense. As I said we installed it using Monit, either way is good.


Attachment removed as a plugin is now available for testing. PM me if you want to try it.
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: nivek1612 on January 09, 2020, 07:11:28 pm
@skywalker007

I can't say if this will work at the same time as IGMPproxy because I haven't tried it

But when I tried to run PIMD and IGMPProxy at the same time PIMD complained
When I tried udp-broadcast-relay-redux with PIMD it worked so my suspicion is udp-broadcast-relay-redux will work with IGMPproxy

But only one way to really know :-)
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: skywalker007 on January 09, 2020, 07:14:22 pm
Thanks. I have to test that at the weekend. Will reply back with results.
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: marjohn56 on January 09, 2020, 11:14:26 pm
I've re-compiled it with a more sensible name and fixed the rc.d file which was badly formatted and Opnsense hated.


I'll re-post the archive tomorrow with full instructions on how and where to install the required bits and how to keep it ticking over using Monit.
Title: Re: [Solved] Sonos on VLANS - PIMD
Post by: skywalker007 on January 09, 2020, 11:35:13 pm
I've re-compiled it with a more sensible name and fixed the rc.d file which was badly formatted and Opnsense hated.


I'll re-post the archive tomorrow with full instructions on how and where to install the required bits and how to keep it ticking over using Monit.
Cool. Looking forward to it! Thanks!


Gesendet von iPad mit Tapatalk
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 10, 2020, 12:32:41 pm

OK, here we go...

The archive contains all you need and a docx file ( sorry using windoze ).

Good luck.


Archive removed. Plugin in beta. PM me if you want to test
Title: Re: [Solved] Sonos on VLANS
Post by: skywalker007 on January 10, 2020, 01:36:02 pm

The archive contains all you need and a docx file ( sorry using windoze ).

No worries, even my mac can display that docx format :-)
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 10, 2020, 10:55:13 pm
Nivek1612 just tested and apart from the fact he cannot spell there appears to be file permission errors.

I have re-zipped it on from the host router so it should all be correct now.
I've also replaced the original attachment in the earlier message.


Attachment removed as a plugin is available for testing. PM me if you want to try it.
Title: Re: [Solved] Sonos on VLANS
Post by: nivek1612 on January 10, 2020, 11:11:33 pm
@marjohn I'm waiting for you to read my last email re /etc/rc.conf.d/  :) :) :)
 
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 10, 2020, 11:25:35 pm
done..  :D
Title: Re: [Solved] Sonos on VLANS
Post by: skywalker007 on January 12, 2020, 12:50:34 pm
Ok, I can confirm this works.
I have not tried replacing  my IGMPproxy for IPTV. I am just running a single instance of the relayproxy for port 1900 for Sonos and that works.
Many thanks for all who contributed to the solution, especially @marjohn56.
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 12, 2020, 04:05:09 pm
Good stuff.

I now have a modified version that will write the pid value etc to /var/run and allows you to specify the name of the pid file if you want. It will auto create a pid file called udpbcastrelay_[ID] using the ID value if you don't set your own pid filename.

It will be useful if you want to run multiple instances without having to rename the exe itself. For example, in Monit you would monitor the process by its ID, obtained from its PID file rather than just the process name itself, it would not work if you tried to monitor two instances with the same process name : :)
Title: Re: [Solved] Sonos on VLANS
Post by: scream on January 13, 2020, 02:59:32 pm
I just found that thread today because im looking for a similar multi VLAN solution for:

- IPTV (Multicast)
- Sonos
- Shelly (CoAP / CoIoT Procotol)
- AirPlay

Is there any package for that already? Can't find it.
Is there any doc's how to configure it? What I have to know/configure to get it working.


TIA. Regards
scream
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 13, 2020, 03:21:23 pm
We're working on a package. In the meantime if you go back a couple of messages in this thread you'll see I posted an archive with all the details on how to install and configure it.


In its present form you'll need to manually configure as Monit is using the process itself to monitor. I have an updated version of the exe that will allow multiple instances from monit but I'm not quite ready to let that out into the world yet. Do do it without monit just use the rc.d stuff but create multiple copies, the instructions are in the docs.


Hopefully, and this is only hopefully if time allows, we'll have a full package available somewhere around 20.1.2
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 14, 2020, 10:28:15 am
I have a plugin ready for testing, single instance only, but if you only need to relay one port then it's good. It will install properly and it installs the daemon as well so there's no hard work involved at all.


Let me know if anyone wants to try it.
Title: Re: [Solved] Sonos on VLANS
Post by: skywalker007 on January 14, 2020, 11:37:20 am
Happy to volunteer for testing.
just let me know what to do with the manually installed pieces (rename/leave there but stop/whatever).
cheers!
Title: Re: [Solved] Sonos on VLANS
Post by: skywalker007 on January 14, 2020, 11:38:44 am
Also - keep in mind, I am on the release, not dev. So I am running 19.7.9.
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 14, 2020, 11:56:37 am
PM me, I'll send you the file and instructions, as for the way you've done it, you can remove it all.
Title: Re: [Solved] Sonos on VLANS
Post by: nivek1612 on January 15, 2020, 04:22:28 pm
tested the plugin in test and now production and works perfect nice smooth install process
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 21, 2020, 11:35:47 pm
Just a note, the plugin handles multiple instances, so you can relay/broadcast more than one port or multicast range, also now handles source address for use with the likes of chromecast.
Title: Re: [Solved] Sonos on VLANS
Post by: szty0pa on January 31, 2020, 07:59:34 pm
Cheers for the great work @marjohn56! I would be very much interested trying it out.
What is the difference between pimd and udp-broadcast-relay? I was thinking pimd forwards the whole 224.0.0.0/4 subnet, but that could have been false.
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on January 31, 2020, 09:17:19 pm
It works better than PIMD  :)


Sent you the plugin link via pm.
Title: Re: [Solved] Sonos on VLANS
Post by: lambrusco on February 16, 2020, 02:21:05 pm
Hey marjohn56, may I have the plugin too?
Thanks!
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on February 16, 2020, 03:38:42 pm
PM  on the way...
Title: Re: [Solved] Sonos on VLANS
Post by: lambrusco on February 17, 2020, 04:22:55 pm
Thanks a lot Marjohn, It works flawless with mDNS (used for AirPlay) but it has some issues with SSDP, here is my scenario:
Network 1: DLNA control point (iPhone Naim app)
Network 2: DLNA media server (QNAP NAS) + DLNA media renderer (Naim streamer
Configured relay to IP 239.255.255.250 for the 1900 UDP port.

Whenever I open the control point application from network 1 I can't see the media server.
If I restart the media server while I'm in the discovery screen of the control point I can see and select the Media Server.
If I close the app and reopen it the media server is gone.
So basically it seems that if the control point is running and the media server send the broadcast message at startup the frames got relayed, otherwise no. Please note that if I keep the control point app on the same network this does not happen and it always shows the Media Server.

Till now I tried to change the TTL flag and also enabled/disabled IGMP snooping, but nothing changes.
Do you have any advice on how can I debug this issue?

Many thanks for your work.
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on February 17, 2020, 04:40:59 pm
Sounds like the media server stops sending once it's got an ack from the control point. @bertofurth may have an idea, he's done some deep discovery work with the daemon.
Title: Re: [Solved] Sonos on VLANS
Post by: Gheek on February 17, 2020, 09:46:48 pm
Hello everyone!
Thanks for your work this sounds amazing.
I am struggling for days to get different services IPTV, Sonos, Phillips etc running.

I would really like to test and give feedback as well. Could you send it to me to?

Best regards
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on February 18, 2020, 09:44:38 am
See https://forum.opnsense.org/index.php?topic=15910.msg72858#msg72858 (https://forum.opnsense.org/index.php?topic=15910.msg72858#msg72858)
Title: Re: [Solved] Sonos on VLANS
Post by: lambrusco on February 18, 2020, 04:18:51 pm
Sounds like the media server stops sending once it's got an ack from the control point.

I will try to debug once I get back home (this weekend) but it seems strange that he stops sending when he receive the ACK as this don't happens when both are connected under the same network.

Maybe @bertofurth has some suggestions on how to debug it.

Please let me know if you want to continue this discussion on the new thread.

Thanks a lot.
Title: Re: [Solved] Sonos on VLANS
Post by: marjohn56 on February 19, 2020, 10:43:19 pm
Network 1: DLNA control point (iPhone Naim app)
Network 2: DLNA media server (QNAP NAS) + DLNA media renderer (Naim streamer
Configured relay to IP 239.255.255.250 for the 1900 UDP port.


Re-reading this those settings are exactly the same as I use for my Sky receiver and app. It works perfectly and I have no issues, it was the reason I went with udpbroadcastrelay to start with as it worked so well. All I can suggest at this point is to do some packet sniffing on both VLANs, firstly when the media server is re-started, then again when it isn't and see what the difference is.