====== Ubiquiti - IGMP Proxy - Sonos ====== For Sonos on a dedicated network (VLAN), but to be able to control it from their main network. Sonos relies heavily on IGMP. * IGMP only works on the same LAN and by design does not work across VLANs. * The solution is using an IGMP-Proxy to repeat the multicast traffic from VLAN the Sonos is on to the main LAN. ---- ===== IGMP-Proxy Configuration ===== Prerequisites: * An always-on Unifi Controller. * Unifi Security Gateway. * Known SSH Credentials for the Controller & USG. * mDNS is Enabled. * IGMP Snooping Enabled on VLANs. * UPnP Enabled for only the IoT LAN. * Multicast Enhancements enabled on Wireless Networks. * LAN to WLAN Multicast & Broadcast Data is not blocked. ---- ===== Create a config.gateway.json file ===== A **config.gateway.json** file is needed to be imported onto the Unifi Controller. **NOTE:** This file is grabbed by the USG every-time it boots and allows you to run advanced features not yet supported by the Unifi GUI. * By default, the **config.gateway.json** file does not exist. It has to be created in order to use it. * This config.gateway.json file is placed under the **/data/sites/site_ID** directory stored on the Controller. * The location **** will vary depending on your operating system. * Often, for the Controller and Linux, it is the **/usr/lib/unifi/data/sites/default/** directory. { "protocols": { "igmp-proxy": { "interface": { "eth1": { "alt-subnet": "0.0.0.0/0", "role": "upstream", "threshold": "1" }, "eth1.10": { "alt-subnet": "0.0.0.0/0", "role": "downstream", "threshold": "1" } } } }, "system": { "task-scheduler": { "task": { "igmpcheck": { "executable": { "path": "/config/igmpcheck.sh" }, "interval": "5m" } } } } } **NOTE:** The file will need to be edited for your network setup and VLAN ids. **eth1** is the default LAN port on the USG. * **eth1** = LAN, **eth1.10** = VLAN 10, **eth1.200** = VLAN 200 * **downstream** = IoT LAN * **upstream** = Main LAN * The **task-scheduler** is to make sure the IGMP-Proxy is running every 5 minutes. * Unifi has a few issues with stopping tasks, and this will correct that. ---- ===== Import the config.gateway.json file into the Controller ===== SSH into the Controller, and import the **config.gateway.json** file into the **/usr/lib/unifi/data/sites/default/** directory. **NOTE:** There are various ways to import a file. Consider **scp** or sftp: sftp://root@servername/directory * The **config.gateway.json** file must have **unifi:unifi** as the owner and group permissions. chown unifi:unifi config.gateway.json ---- ===== igmpcheck.sh ===== Once the file is in the Unifi Controllers directory after a reboot/ provision of the USG you may notice the IGMP-Proxy begins working. For unknown reasons with Unifi the IGMP-Proxy will suddenly stop running, the igmpcheck.sh script will check to confirm if it is running or not and start the IGMP-Proxy if required. #!/bin/bash pidof igmpproxy >/dev/null if [[ $? -ne 0 ]] ; then echo "restarting igmp-proxy" /bin/vbash -ic 'restart igmp-proxy' fi **NOTE:** Once the **igmpcheck.sh** script is ready it needs to be imported into the USG (not the Unifi Controller) using SSH. * Import the file into the **/config/** directory/ ---- ===== Reboot the network ===== **NOTE:** Only reboot the network, and not the Unifi Controller. ---- ===== Test the Sonos ===== Test the Sonos App on the main LAN. **NOTE:** You should see all the functionality of the Sonos app is working. ---- ===== Troubleshooting ===== If issues are seen, you may need to set the "Upstream" subnet as your WAN and the "Downstream" as your LAN; by changing the interface in the configuration. ==== Check if the proxy is working ==== * SSH into the Controller. * View all running services. and run: ps -ax **NOTE:** This will list the running services. * In the list look for this service **/sbin/igmpproxy /etc/igmpproxy.conf** that should indicate the service is running in the background. ---- ===== References ===== https://help.ui.com/hc/en-us/articles/215458888-UniFi-USG-Advanced-Configuration-Using-config-gateway-json https://www.nathandare.com/projects/igmp-proxy-configuration-with-sonos