How to Set aria2 BitTorrent Port Range?
Configuring the network ports for BitTorrent traffic in aria2 is essential for optimizing download speeds, ensuring proper port forwarding, and navigating firewall restrictions. By default, aria2 utilizes a specific range of ports to establish connections with peers in the BitTorrent network. This article provides a quick overview of the exact command-line flag used to define this port range, along with practical examples of how to implement it in your download workflows.
The BitTorrent Port Range Flag
To specify the listening port range for BitTorrent connections in
aria2, you use the --bt-port flag. This
option allows you to define a single port or a range of ports that aria2
will attempt to bind to for incoming BitTorrent traffic.
Syntax and Usage
The basic syntax for the flag requires you to pass either a single port number or a pair of port numbers separated by a hyphen.
aria2c --bt-port=<PORT>|<START>-<END> [URL|MAGNET]Practical Examples
- Setting a Specific Port Range: If you want aria2 to use ports between 6881 and 6889, you would structure the command like this:
aria2c --bt-port=6881-6889 "magnet:?xt=urn:btih:..."- Setting a Single Explicit Port: If your router has a specific port forwarded (for example, port 50000), you can restrict aria2 to only use that port:
aria2c --bt-port=50000 "magnet:?xt=urn:btih:..."Important Considerations
- Default Behavior: If this flag is not specified,
aria2 typically defaults to the port range of
6881-6999. - Port Forwarding: For optimal download speeds and to
achieve an “open” NAT status, ensure that the port range you specify in
the
--bt-portflag is also forwarded correctly in your router’s settings for both TCP and UDP traffic. - Configuration File: Instead of typing the flag
every time in the command line, you can add
bt-port=6881-6889directly to youraria2.conffile for permanent configuration.