Tuesday, September 19, 2017

OpenWRT - Making Wired DLNA Server Visible to WiFi Streaming Device

Overview

This article describes how to solve the issue described by these circumstances:
  • You have a DLNA media server connected to the "Wired"/LAN side of a router running OpenWRT.
  • You have a media-player / streaming-client (like a Roku) connected to the WiFi side of the same router.
  • Your player can't find the media server.
  • You've already tried disabling multicast_snooping and that didn't help.
Note: For me, this applies to OpenWRT Chaos Calmer, running on a TP-Link Archer C7, but it probably affects others as well.

What's Really Wrong

That heading is a little misleading.  Part of what's wrong is actually the multicast_snooping thing.  So you still need to do that part, per: https://wiki.openwrt.org/doc/recipes/dumbap#multicast_forwarding
  •  echo "0" > /sys/devices/virtual/net/br-lan/bridge/multicast_snooping
  • Also add that same command to /etc/local.rc so it survives a reboot.
According to the docs on the OpenWRT site and several other places, that's all you should need to do, but the OTHER part of what's wrong, that isn't really mentioned anywhere, is that iptables is probably dropping the multicast packets before they can even be "snooped."

Steps to Get the "Other" Part Fixed

  1. Install support for iptables/firewall rules based on packet-type. (from an ssh prompt)
    • opkg install iptables-mod-extra
    • See: https://wiki.openwrt.org/doc/howto/netfilter#opkg_netfilter_packages
  2. Add a custom rule to your firewall configuration.
    • In the Luci web interface, that's under the Network->Firewall menu, in the "Custom Rules" section, or from an ssh prompt, edit (e.g. open with vi or vim) /etc/firewall.user
    • The rule:
      • iptables --insert forwarding_rule -m comment --comment "allow multicast from wired to wireless interfaces" -m pkttype --pkt-type multicast -j ACCEPT
  3. Restart the firewall (from an ssh prompt)
    • /etc/init.d/firewall restart
    • Assure that there are no errors like "Couldn't load match `pkttype'"

Summary

After disabling multicast_snooping and adding the firewall rule to allow multicast packets to pass from anywhere to anywhere else, the DLNA server, connected via ethernet/wired should show up immediately on streaming devices connected to WiFi.

Update

Even with the firewall open for all multicast packets, this was still flaky and intermittent.  Then it occurred to me that all of my wired devices were hooked into a Netgear GS116Ev2 - 16-Port Gigabit ProSAFE Plus Switch.  That switch ALSO had an IGMP/MultiCast Snooping feature, and it was ALSO enabled by default.  After turning that off AND disabling multicast_snooping in OpenWRT, the DLNA media server pops right up in the Roku player every time.

References

* https://forum.openwrt.org/viewtopic.php?pid=198895#p198895
* https://wiki.openwrt.org/doc/recipes/dumbap#multicast_forwarding
* https://dev.openwrt.org/ticket/13042
* https://www.garyhawkins.me.uk/dlna-upnp-and-multicast-routing/


No comments: