qBittorrent NAT TCP Hole Punching
Use Natter/NATMap to perform TCP hole punching under Full Cone NAT, making qBittorrent for a public IPv4-like experience.
Requirement
-
Full Cone NAT.
-
The device running the script is only under one layer of NAT. If you run the script on other devices on the subnet, you can enable DMZ on the router.
-
qBittorrent is installed on the device running the script. If this condition is not met, you can manually modify the iptables port forwarding part of the script.
Usage
-
Download the
update.sh
script. -
You can use Natter or NATMap as hole punching program. Take NATMap as an example, download the NATMap binary file and put it in the same directory as
update.sh
. -
Edit
update.sh
:- private_port: Natter fills in $3/NATMap fills in $4
- public_port: Natter fills in $5/NATMap fills in $2
- qb_web_port: The port of qBittorrent web service, usually 8080
- qb_username: username
- qb_password: password
-
Take NATMap as an example, run
sudo ./natmap -s stun.stunprotocol.org -h bing.com -b 45678 -e ./update.sh
.Among them,
stun.stunprotocol.org
is the STUN server address, andbing.com
is the public network HTTP server address, which is used to maintain the NAT mapping relationship and generally does not need to be modified.45678
is any locally available port.