dhttrackertorrent

Why DHT can't find resource when to download with a trackerless torrent?


Please do as i do in your vps and then maybe the issue reproduced,replace the variable $vps_ip with your real vps ip during the below steps.

wget  https://saimei.ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-10.4.0-amd64-netinst.iso
transmission-create -o  debian.torrent   debian-10.4.0-amd64-netinst.iso

Create a trackerless torrent ,show info on it:

transmission-show  debian.torrent
Name: debian-10.4.0-amd64-netinst.iso
File: debian.torrent

GENERAL

  Name: debian-10.4.0-amd64-netinst.iso
  Hash: a7fbe3ac2451fc6f29562ff034fe099c998d945e
  Created by: Transmission/2.92 (14714)
  Created on: Mon Jun  8 00:04:33 2020
  Piece Count: 2688
  Piece Size: 128.0 KiB
  Total Size: 352.3 MB
  Privacy: Public torrent

TRACKERS

FILES

  debian-10.4.0-amd64-netinst.iso (352.3 MB)

Open the port which transmission running on your vps.

firewall-cmd --zone=public --add-port=51413/tcp --permanent
firewall-cmd --reload

Check it from your local pc.

sudo nmap $vps_ip -p51413
Host is up (0.24s latency).
PORT      STATE SERVICE
51413/tcp open  unknown
Nmap done: 1 IP address (1 host up) scanned in 1.74 seconds

Add the torrent and seed it with transmission's default username and password on your vps(with your own if you already change it):

transmission-remote  -n  "transmission:transmission"  --add  debian.torrent
localhost:9091/transmission/rpc/ responded: "success"
transmission-remote  -n  "transmission:transmission"  --list
ID     Done       Have  ETA           Up    Down  Ratio  Status       Name
   1     0%       None  Unknown      0.0     0.0   None  Idle         debian-10.4.0-amd64-netinst.iso
Sum:              None               0.0     0.0
transmission-remote  -n  "transmission:transmission"  -t 1 --start
localhost:9091/transmission/rpc/ responded: "success"

Get the debian.torrent from your vps into local pc.

scp root@$vps_ip:/root/debian.torrent   /tmp  

Now to try download it in your local pc.

aria2c --enable-dht=true  /tmp/debian.torrent

06/08 09:28:04 [NOTICE] Downloading 1 item(s)

06/08 09:28:04 [NOTICE] IPv4 DHT: listening on UDP port 6921

06/08 09:28:04 [NOTICE] IPv4 BitTorrent: listening on TCP port 6956

06/08 09:28:04 [NOTICE] IPv6 BitTorrent: listening on TCP port 6956
 *** Download Progress Summary as of Mon Jun  8 09:29:04 2020 ***              
===============================================================================
[#a34431 0B/336MiB(0%) CN:0 SD:0 DL:0B]
FILE: /tmp/debian-10.4.0-amd64-netinst.iso
-------------------------------------------------------------------------------

I wait about one hour ,the download progress is always 0%.


Solution

  • If you're using DHT, you have to open a UDP port in your firewall and then, depending on what you're doing, you can specify that port to aria2c. From the docs:

    DHT uses UDP. Since aria2 doesn't configure firewalls or routers for port forwarding, it's up to you to do it manually.

    $ aria2c --enable-dht --dht-listen-port=6881 file.torrent
    

    See this page for some more examples of using DHT with aria2c.