Skip to content

🚢 Automatically update the qBittorrent listening port based on the Private Internet Access forwarded port.

License

Notifications You must be signed in to change notification settings

Aldaviva/PortForwardingManager

PortForwardingService PortForwardingService

Integrate the qBittorrent BitTorrent client with the Private Internet Access (PIA) virtual private network service.

  1. Features
  2. Requirements
  3. Installation
  4. Configuration

Features

  • Automatically set the qBittorrent listening port to the PIA forwarded port any time it changes.
    • This makes NAT traversal work and allows you to connect to as many peers as possible, likely speeding up your transfers.
    • UPnP does not integrate with PIA, only your router.
    • The VPN forwarded port can change at any time, so manually copying and pasting it from PIA into the qBittorrent settings would be annoying and unreliable.
  • Automatically fix the random Failed to listen on IP. IP: "1.2.3.4". Port: "TCP/12345". Reason: "The requested address is not valid in its context" qBittorrent errors.
    • This error occurs intermittently and blocks all transfers until you restart qBittorrent or change the listening port.

Requirements

Installation

  1. Download PortForwardingService.zip from the latest release.
  2. Extract the ZIP file to a directory such as C:\Program Files\PortForwardingService\.
    • If you are upgrading an existing installation, don't overwrite NLog.config if you have previously modified it, or else your changes will be lost.
  3. In an elevated PowerShell terminal, run
    New-Service -Name "PortForwardingService" -BinaryPathName "C:\Program Files\PortForwardingService\PortFowardingService.exe" -DisplayName "Port Forwarding Service" -Description "Automatically update the qBittorrent listening port to be the Private Internet Access forwarded port whenever it changes."
    replacing the installation directory if you chose a different one in step 2.
  4. Run services.msc.
  5. Select Port Fowarding Service.
  6. Go to Properties › Log On, choose This account, and type in your Windows username and password.
    • This allows the service to edit the qBittorrent.ini configuration file in your user profile directory, which is used to set the listening port when qBittorrent is not running.
  7. Start the service.

Configuration

  1. Enable VPN port forwarding.
    1. In the Private Internet Access desktop client, connect to a VPN server that allows port forwarding (does not have an ⇍ icon in the server list).
    2. Enable Settings › Network › Request Port Forwarding.
    3. Ensure PIA shows a forwarded port number under VPN IP, such as ↩ 12345. If it doesn't, try reconnecting or choosing a different server.
  2. Open qBittorrent › Tools › Options.
    1. Disable Connection › Use UPnP / NAT-PMP port forwarding from my router.
    2. Set Advanced › qBittorrent Section › Network Interface to the active PIA virtual network interface.
      • If you have enabled the WireGuard VPN protocol in PIA instead of OpenVPN, this interface will be named something like wgpia0.
      • If you're not sure which interface PIA is providing, open ncpa.cpl and rename the active connection that uses the Private Internet Access Network Adapter to a recognizable name like "PIA".
    3. Enable Web UI › Web User Interface.
    4. Set Web UI › Port to 8080.
    5. Enable Web UI › Bypass authentication for clients on localhost.
    6. Disable Web UI › Use UPnP / NAT-PMP to forward the port from my router.
    7. Disable Web UI › Use HTTPS instead of HTTP.
    8. Ensure the PIA forwarded port appears in qBittorrent › Connection › Listening Port. If it doesn't, try restarting Port Forwarding Service.

Logging

By default, log messages are written to the text file %LOCALAPPDATA%\PortForwardingService\logs\PortForwardingService.log.

You can customize the log format, filename, level, and other options by editing NLog.config in the installation directory.

About

🚢 Automatically update the qBittorrent listening port based on the Private Internet Access forwarded port.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Contributors 2

  •  
  •  

Languages