Unable to download torrent in Transmission after updating firewall

I recently updated (enabled and updated) firewall setting using this guide on wiki.ubuntu.com. I followed Method 2 UFW. However, after completing the process am unable to download torrents in Transmission.

The guide mentions Transmission port rules:

And now our Transmission rules

sudo ufw allow out 51413/tcp
sudo ufw allow out 51413/udp
sudo ufw allow out 6969/tcp

Under Preference -> Network in Transmission

The Port for incoming connections (which is) 51413 shows Port is closed when I click Test Port.

Please help me resolve this issue. Am just an average user (also new to linux), so please kindly break it down so that I would be able to understand you.

Ubuntu version 16.10

result of sudo ufw status

Status: active

To                         Action      From
--                         ------      ----
25,53,80,110,443/tcp       ALLOW OUT   Anywhere                  
53,67,68/udp               ALLOW OUT   Anywhere                  
51413/tcp                  ALLOW OUT   Anywhere                  
51413/udp                  ALLOW OUT   Anywhere                  
6969/tcp                   ALLOW OUT   Anywhere                  
123/udp                    ALLOW OUT   Anywhere                  
25,53,80,110,443/tcp (v6)  ALLOW OUT   Anywhere (v6)             
53,67,68/udp (v6)          ALLOW OUT   Anywhere (v6)             
51413/tcp (v6)             ALLOW OUT   Anywhere (v6)             
51413/udp (v6)             ALLOW OUT   Anywhere (v6)             
6969/tcp (v6)              ALLOW OUT   Anywhere (v6)             
123/udp (v6)               ALLOW OUT   Anywhere (v6)             

Solution 1:

Your port 51413 appears closed because you didn't allow incoming connections, you only allowed outgoing connections. The guide you followed is wrong in this point.

Delete the rules related to port 51413. To do that run

sudo ufw status numbered

and then delete the four related rules with

sudo ufw delete #

Replace # with the numbers you got before, you will have to run this command four times to get rid of all of them.

Now add a new rule which allows incoming connections with

sudo ufw allow 51413

To apply the changes reload the firewall rules with

sudo ufw reload

or

sudo ufw disable
sudo ufw enable

Remind that this port (51413) needs to be forwarded in your router, if the port is not forwarded in the router, incoming connections will get denied in your router before they reach your computer and the port will still appear as closed.

The Bittorrent-network is a peer-to-peer network and lives from connectivity. If a client on the network does not allow incoming connections, this client can only connect to clients which allow incoming connections. If not even a single client on the network allows incoming connections, no client would be able to connect to other clients, the network become useless.

You would still be able to download torrents if you don't allow incoming connections, but you can't connect to other peers which also deny incoming connections. Thus, the number of peers you can connect to is limited and this reduces download speed or, in the worst case, you can't download at all.

I think it is a common problem with bittorrents, many people don't know to configure their firewall and router correctly.

How to forward a port in the router is a topic which is not in the scope of askubuntu. You will have to refer to the manual of your router. For some knowledge about this topic take a look at https://portforward.com/ .

To learn more about the usage of ufw take a look at:

  • http://manpages.ubuntu.com/manpages/precise/man8/ufw.8.html
  • https://help.ubuntu.com/community/UFW

Following the guide you used you have a firewall which is very restrictive, you set the defaults to deny all incoming and all outgoing connections. You will have to add rules to allow connections for each application which needs Internet-access and uses ports which are not defined in your rules yet. Remind that when you install a new application and you wonder why the application does not have access to the Internet.