DLNA communication through the router

Discover how you can configure DLNA client so it can communicate with DLNA server that operates behide the router.

Topology

Smart TV (DLNA client) <-> Ubuntu PC (router) <-> DLNA server

Smart TV – eth0 192.168.3.101
Ubuntu PC – eth0 192.168.3.100, wlan0 192.168.1.100
DLNA server – eth0 192.168.1.81
Internet gateway (ddwrt) – br0 192.168.1.254

DLNA discovery

DLNA server will send a notify packet to multicast group 239.255.255.250 and UDP port 1900 and all DLNA clients will receive that packet sent to this multicast group. Packet will contain an IP address and port on which DLNA server is listening on, then client will be able to start a unicast communication with the server over 192.168.1.81 IP address and TCP port 8200 (default port).

In order to provide this kind of communication through the router we have to configure a static multicast routing. We can configure multicast routing with smcroute tool (allows you to manipulate with multicast static routes which are part of the Linux kernel)

smcroute installation

First we have to be sure that multicast support is enabled in the Linux kernel

Output:

or

Output:

Install smcroute package on Ubuntu OS

Multicast routing

Adding multicast static routes after system boot
Add these lines to /etc/rc.local file

For some reason multicast routing isn’t enabled for wlan0 interface during the boot process so we have to stop and then start smcroute service so we can activate multicast routing for both interfaces.

In order to check if multicast routing (mc_forwarding read-only kernel parameter) is enabled for particular interface you can use sysctl tool. Value of 1 means routing is enabled and value of 0 means routing is disabled

Output:

IP routing

In order to activate IP routing we have to:

  • Activate IP routing on Ubuntu system
  • Configure a static route on the internet Gateway (ddwrt)

Activate IP routing on Ubuntu system

In order to provide internet communication and communication to other local networks (192.168.1.0) to all devices from 192.168.3.0 network (in our case SmartTV) we have to activate IP routing:

Configure a static route on the internet Gateway (ddwrt)

In the last step we have to configure a static route on the internet Gateway (in our case ddwrt) for 192.168.3.0 network. This will allow our Smart TV (DLNA client) to receive data back from the 192.168.1.0 local network and from the internet.

Alnalyzing multicast traffic

If we want to analyze network traffic on both interfaces we can use:

or

And if we want some more information related to the network traffic running through the Ubuntu router we can always use more advanced tools like tcpdump and wireshark

Leave a Comment

Your email address will not be published. Required fields are marked *