1

Which firewall ports have to be open for a DLNA client running on Ubuntu?

I have found incoming restrictive rules to be a show stopper for the DLNA discovery service on a client machine running Ubuntu. Which ports have to be open for the client DLNA discovery service? I am using Grilo plugin for both Totem and Rhythmbox.

EDIT: With DLNAautoAddports.sh following Rhythmbox and Totem start script is working:

#!/bin/bash
a=0
for i in `seq 1 15`;
do

    sudo ./DLNAAutoAddPorts.sh;sleep 0.1
    if [ "$a" = "0" ]; then
        rhythmbox&        
        a=1
    fi      

    echo $i
done 

Contens of DLNAAutoAddPorts.sh is here.

2
  • have you tried it with vlc? Jun 11, 2017 at 9:43
  • Yes, the same result. When I switch off the firewall, the network discovery for dlna works. My ufw settings are outgoing traffic allow, incoming traffic refuse except outbound connections. I tried to open ports 1900 and 8200, but that is not sufficient. The dlna discovery needs some additional ports.
    – kukulo
    Jun 11, 2017 at 16:08

2 Answers 2

2

I use different DLNA servers, ie bubbleupnp, minidlna & rygel however they all suffer the same issue.

So I wrote a program that takes care if it. You may find it useful, I've tested with Rhythmbox but not totem, if you fancy giving it a go let me know whether it worked for you.

It basically monitors your DLNA programs and opens the ports they require subject to a few appropriate limitations.

The script can be downloaded here

Update: I've loaded Rhythmbox and enabled the Grilo package and I can access other DLNA servers on the LAN without any problems. The DLNAAutoAddPorts.sh script takes care of opening the required ports.

14
  • Looks good, are there any particular modifications of your script required?
    – kukulo
    Aug 28, 2017 at 5:30
  • I tried it, but does not work as expected. After I have run the script, the ports were opened, but the dleyna network discovery is somehow slow and unreliable. I guess that there is still missing something because with firewall turned off all works as expected. Of course the application using dleyna have to be restarted.
    – kukulo
    Aug 28, 2017 at 16:26
  • I'll take a look into it, for that particular server maybe I need to check for ports that have more than just LISTEN & ESTABLISHED as their status. May take a few days.. Aug 29, 2017 at 8:57
  • It looks like dleyna is opening/closing ports, possibly during searching far faster than this script could keep up, this is different to the way minidlna & bubbleupnp work. To 'possibly' fix the problem I'd need to have the script running every 10 seconds maybe even faster and take into account other port statuses so the port isn't closed by the script too soon. Ideally instead of using the cron, I'd need to use inotify to trigger the script then it's response would be much faster. May take more than a few days but I'll let you know. Aug 29, 2017 at 9:22
  • I checked the firewall and the ports have to be open before the program start. I have checked it with firewall rules with opening ports from the local dlna server from port 32000 to 55000. Then the network discovery works. Unfortunately there is no reload button on the rhytmbox or totem.
    – kukulo
    Aug 29, 2017 at 10:54
1
+50

Use the command: Sudo lsof -i -n -P | more This command lists the Application Name, PID, User, IP version, Device ID and the Node with Port Name. It shows both TCP and UDP.

  • To view only TCP connections use: sudo lsof -i tcp -n -P | more
  • To view only UDP connections use: sudo lsof -i udp -n -P | more
  • If you don't have the command available use this command to install lsof: sudo apt-get install lsof
5
  • I have found out that the dleyna-server-service is starting a connection to the same machine: dleyna-se 11031 user 19u IPv4 98359 0t0 TCP 192.168.99.58:42286 (LISTEN)
    – kukulo
    Jun 11, 2017 at 18:09
  • The port is 42286 which needs to be open, but every time I restart the dlna client, the port is different and therefore not predicable. Are there any settings for the dleyna service regarding ports?
    – kukulo
    Jun 11, 2017 at 18:11
  • how come you restart the client and the server changes the port?? Jun 11, 2017 at 18:30
  • check the port in which the server is running, and open the port in your firewall settings. Jun 12, 2017 at 3:35
  • The client does not bind to a specific port. Strange is that the client connects to the client machine to 42286 port and then to the server. The server is ok working with another client - android and tv. When I turn on the firewall, then the 42286 port is not shown in the lsof. So the 42286 is connected to the dlna discovery. Each client start changes the port 42286 to something new. Is there any possibility to bind the dleyna service on the client to a specific port?
    – kukulo
    Jun 12, 2017 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.