1

I am at my wits' end and cannot get KTorrent to download under my current ufw settings. I am using Kubuntu 16.04.

As I understand from reading the configuration window, KTorrent uses the following ports

  • 6881
  • UDP tracker: 8881 UDP
  • Representative server (system language is not English and have to translate this: it is the next option under network on the left) HTT "use KDE representative server." Port 8080 shows up in a greyed out box.
  • DHT port 7881.

I have been trying for hours to find the correct ufw rules. Here is the output of ufw status numbered.

 Vers                       Action      De
 ----                       ------      --
[ 1] 25/tcp                     ALLOW OUT   Anywhere                   (out)
[ 2] 53/tcp                     ALLOW OUT   Anywhere                   (out)
[ 3] 80,110,443,465,587/tcp     ALLOW OUT   Anywhere                   (out)
[ 4] 53,67,68/udp               ALLOW OUT   Anywhere                   (out)
[ 5] 143,993/tcp                ALLOW OUT   Anywhere                   (out)
[ 6] 47638/tcp                  ALLOW OUT   Anywhere                   (out)
[ 7] 47638/udp                  ALLOW OUT   Anywhere                   (out)
[ 8] 7881/tcp                   ALLOW OUT   Anywhere                   (out)
[ 9] 7881/udp                   ALLOW OUT   Anywhere                   (out)
[10] 8080/tcp                   ALLOW OUT   Anywhere                   (out)
[11] 8080/udp                   ALLOW OUT   Anywhere                   (out)
[12] 6881                       ALLOW IN    Anywhere                  
[13] 8881/udp                   ALLOW IN    Anywhere                  
[14] 25/tcp (v6)                ALLOW OUT   Anywhere (v6)              (out)
[15] 53/tcp (v6)                ALLOW OUT   Anywhere (v6)              (out)
[16] 80,110,443,465,587/tcp (v6) ALLOW OUT   Anywhere (v6)              (out)
[17] 53,67,68/udp (v6)          ALLOW OUT   Anywhere (v6)              (out)
[18] 6881/tcp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[19] 6881/udp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[20] 143,993/tcp (v6)           ALLOW OUT   Anywhere (v6)              (out)
[21] 47638/tcp (v6)             ALLOW OUT   Anywhere (v6)              (out)
[22] 47638/udp (v6)             ALLOW OUT   Anywhere (v6)              (out)
[23] 7881/tcp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[24] 7881/udp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[25] 8080/tcp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[26] 8080/udp (v6)              ALLOW OUT   Anywhere (v6)              (out)
[27] 6881 (v6)                  ALLOW IN    Anywhere (v6)             
[28] 8881/udp (v6)              ALLOW IN    Anywhere (v6)  

Before making these rules, I set my default incoming and outgoing to deny, following this guide. The minute I disable ufw, everything works again.

Edit: Here are is a hopefully reprsentative sample of the output of grep "7881" /var/log/ufw.log. It seems to be the source during many blocking events, even though I have it set as open. I must be misinterpreting the logs. Port 8080 isn't mentioned anywhere in them, though.

Jun 29 21:05:11 stefan-Aspire-F5-573T kernel: [16073.180993] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.58.99.71 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=32239 DF PROTO=UDP SPT=7881 DPT=23935 LEN=102 
Jun 29 21:05:11 stefan-Aspire-F5-573T kernel: [16073.181016] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.58.99.71 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=32240 DF PROTO=UDP SPT=7881 DPT=23935 LEN=102 
Jun 29 21:05:11 stefan-Aspire-F5-573T kernel: [16073.181056] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=84.80.41.91 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=40119 DF PROTO=UDP SPT=7881 DPT=51413 LEN=102 
Jun 29 21:05:11 stefan-Aspire-F5-573T kernel: [16073.181076] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=84.80.41.91 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=40120 DF PROTO=UDP SPT=7881 DPT=51413 LEN=102 
Jun 29 21:05:41 stefan-Aspire-F5-573T kernel: [16103.314240] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.55.188.47 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=59088 DF PROTO=UDP SPT=7881 DPT=6881 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.982845] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=73.207.219.79 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=26113 DF PROTO=UDP SPT=7881 DPT=8999 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.982886] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=73.207.219.79 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=26114 DF PROTO=UDP SPT=7881 DPT=8999 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.982941] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=185.45.195.189 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=5856 DF PROTO=UDP SPT=7881 DPT=28066 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.982969] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=185.45.195.189 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=5857 DF PROTO=UDP SPT=7881 DPT=28066 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983012] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=163.172.36.40 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=35696 DF PROTO=UDP SPT=7881 DPT=6881 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983036] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=163.172.36.40 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=35697 DF PROTO=UDP SPT=7881 DPT=6881 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983078] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.58.99.71 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=34462 DF PROTO=UDP SPT=7881 DPT=23935 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983100] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.58.99.71 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=34463 DF PROTO=UDP SPT=7881 DPT=23935 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983142] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=84.80.41.91 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=44596 DF PROTO=UDP SPT=7881 DPT=51413 LEN=102 
Jun 29 21:10:31 stefan-Aspire-F5-573T kernel: [16394.983167] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=84.80.41.91 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=44597 DF PROTO=UDP SPT=7881 DPT=51413 LEN=102 
Jun 29 21:11:01 stefan-Aspire-F5-573T kernel: [16425.116434] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.55.188.47 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=22519 DF PROTO=UDP SPT=7881 DPT=6881 LEN=102 
Jun 29 21:12:32 stefan-Aspire-F5-573T kernel: [16515.752536] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=73.207.219.79 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=37743 DF PROTO=UDP SPT=7881 DPT=8999 LEN=102 
Jun 29 21:13:02 stefan-Aspire-F5-573T kernel: [16545.886059] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=45.55.188.47 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=22567 DF PROTO=UDP SPT=7881 DPT=6881 LEN=102 
Jun 29 21:14:32 stefan-Aspire-F5-573T kernel: [16636.536352] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=73.207.219.79 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=46899 DF PROTO=UDP SPT=7881 DPT=8999 LEN=102 
Jun 29 21:14:32 stefan-Aspire-F5-573T kernel: [16636.536446] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=73.207.219.79 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=46900 DF PROTO=UDP SPT=7881 DPT=8999 LEN=102 
Jun 29 21:14:32 stefan-Aspire-F5-573T kernel: [16636.536592] [UFW BLOCK] IN= OUT=wlp2s0 SRC=192.168.1.4 DST=185.45.195.189 LEN=122 TOS=0x00 PREC=0x00 TTL=64 ID=35622 DF PROTO=UDP SPT=7881 DPT=28066 LEN=102

Here are some incoming events

Jun 29 20:47:42 stefan-Aspire-F5-573T kernel: [15019.998495] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=187.127.184.39 DST=192.168.1.4 LEN=293 TOS=0x00 PREC=0x00 TTL=111 ID=31463 PROTO=UDP SPT=10923 DPT=7881 LEN=273 
Jun 29 20:47:43 stefan-Aspire-F5-573T kernel: [15021.147024] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=123.203.64.166 DST=192.168.1.4 LEN=293 TOS=0x00 PREC=0x00 TTL=111 ID=1847 PROTO=UDP SPT=7510 DPT=7881 LEN=273 
Jun 29 20:48:08 stefan-Aspire-F5-573T kernel: [15045.794512] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=213.136.79.27 DST=192.168.1.4 LEN=125 TOS=0x00 PREC=0x00 TTL=54 ID=8251 DF PROTO=UDP SPT=51441 DPT=7881 LEN=105 
Jun 29 20:48:20 stefan-Aspire-F5-573T kernel: [15057.622817] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=79.97.64.25 DST=192.168.1.4 LEN=132 TOS=0x00 PREC=0x00 TTL=49 ID=42367 DF PROTO=UDP SPT=6881 DPT=7881 LEN=112 
Jun 29 20:49:16 stefan-Aspire-F5-573T kernel: [15113.782068] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=213.136.79.205 DST=192.168.1.4 LEN=125 TOS=0x00 PREC=0x00 TTL=53 ID=2902 DF PROTO=UDP SPT=7186 DPT=7881 LEN=105 
Jun 29 20:49:51 stefan-Aspire-F5-573T kernel: [15148.855060] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=213.136.79.27 DST=192.168.1.4 LEN=125 TOS=0x00 PREC=0x00 TTL=53 ID=26442 DF PROTO=UDP SPT=51467 DPT=7881 LEN=105 
Jun 29 20:50:05 stefan-Aspire-F5-573T kernel: [15163.009876] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=213.136.79.7 DST=192.168.1.4 LEN=125 TOS=0x00 PREC=0x00 TTL=53 ID=61420 DF PROTO=UDP SPT=11928 DPT=7881 LEN=105 
Jun 29 20:50:19 stefan-Aspire-F5-573T kernel: [15177.038100] [UFW BLOCK] IN=wlp2s0 OUT= MAC=94:e9:79:de:0e:6b:a0:63:91:04:52:68:08:00 SRC=213.136.79.205 DST=192.168.1.4 LEN=125 TOS=0x00 PREC=0x00 TTL=53 ID=13626 DF PROTO=UDP SPT=7186 DPT=7881 LEN=105 

I opened port 8999 incoming UDP and can now download torrents that are already started. That is, if I disable the firewall, start downloading and enable, the downloads will now continue. If stopped, they will not resume. Also, magnet links will not download while the firewall is enabled.

1 Answer 1

0

Did you check the ufw logs?

You should first enable them if not already. And I wonder if you should be adding 7881/tcp IN rule & 8080/tcp IN rules as well - but that's to be answered after checking your logs. After enabling logs, try quitting & re-opening ktorrent, as it should check for port 8080 on startup (probably), which then should lead to some entries in ufw logs.

4
  • I have looked at the logs and edited my question with what I found. Jun 30, 2017 at 1:26
  • But 7881 IN is not in your allow list, just OUT. Jun 30, 2017 at 3:09
  • But on the other hand, you're right about the out blockage on 7881 UDP, I'm baffled at that point, as it's already open. Jun 30, 2017 at 3:14
  • Perhaps the log entries are due the phenomenon described here: askubuntu.com/questions/299964/… Jun 30, 2017 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .