How-to guide
Why has the PIA port forwarding script stopped working?
If the PIA script receives a port, but after reconnecting or restarting the container the incoming connections have disappeared, according to the NAT Checker guide the cause is a new random PIA port: it needs to be transferred to the receiving application manually or synchronised via the API. For the old curl script that broke after IP rotation, NAT Checker describes a different mechanism: the tunnel gateway IP changes before the NextGen token update completes; in Gluetun and TrueNAS SCALE this shows up as the "cannot find API IP" error. To restore the setting in the PIA graphical client, you need to disconnect the VPN, enable Settings > Network > Request Port Forwarding, connect to a supported location outside the United States, and transfer the port shown by PIA to the receiving application.
From VPN Brand Reviews Updated Reading time: 5 min
Desynchronisation is confirmed by a difference between the current PIA port and the port in the receiving application. The gateway change described by NAT Checker relates to the "cannot find API IP" error scenario after IP rotation and serves as a separate hypothesis when analysing a specific script.
If it does not work: obtaining the port or incoming connections
The diagnostics split into three branches: the port is not obtained, the application port is out of date, or the values match without available incoming connections. Matching numbers do not yet prove that the application is reachable.
| Symptom | What to check | Observable result | Next action |
|---|---|---|---|
| The script does not obtain a port | The script or container log and the selected location | If the port value is absent, record the exact error | For "cannot find API IP", match the symptom against the NAT Checker explanation about the gateway changing before the token update; keep the details for analysis |
| Port obtained | The current value in the script or container output and the port of the receiving application | If the values differ, the application is using a different port | Transfer the current port manually or check the existing propagation of the update via the API script; repeat the comparison after reconnecting |
| The values match but connections are unavailable | The running application, the port and protocol in the firewall, the public VPN address from another network | Record whether the application is running, whether the traffic is allowed and whether the external check passes | Start the application, allow the required traffic and record the result of each check |
According to NAT Checker, after a disconnection, reconnection or container restart PIA assigns a new random port. Therefore a successfully obtained value must reach the receiving application manually or via an API script. A failure to obtain the port and a desynchronised application require different actions.
Analysing the failure requires:
- the name and version of the client or container;
- the source and version of the script;
- the exact error and the adjacent log lines without tokens and passwords;
- the selected location and protocol;
- the moment of the failure relative to the reconnection.
Setting up PIA: enabling port forwarding in the application
These steps enable port forwarding in the PIA graphical client; script and container diagnostics are covered above.
- Disconnect the VPN in the PIA application.
- In Settings > Network, enable Request Port Forwarding.
- In the server list, choose a supported location outside the United States with the icon of two opposing arrows.
- Connect to the chosen PIA server.
- Find the assigned port on the PIA main screen under VPN IP.
- Enter the obtained port in the receiving application, for example in your torrent client.
Geekchamp restates the PIA support limitation: port forwarding works only in supported server locations. The arrows icon as a practical marker is described by NAT Checker; according to the vpnMentor review, port forwarding is unavailable on servers in the United States. The location of the assigned port under VPN IP is confirmed by the PortForward instructions.
Checking the result: incoming connections through the tunnel
With port forwarding over a VPN, incoming traffic passes through the VPN server and the tunnel. Checking port forwarding on your home router does not replace checking the public VPN address. NAT Checker recommends the following order:
- Start the receiving application on the device.
- Allow the corresponding port and protocol in the firewall.
- From another network, for example via mobile data, check the public VPN address and the assigned port.
If the external check shows a closed port, you need to start the receiving application and allow the corresponding port and protocol in the firewall. After reconnecting, compare the current PIA port with the application setting and repeat the check from another network.
Verify: according to the NAT Checker explanation, UDP 51820 is used for the WireGuard handshake. To check the application's incoming connections, you need the port assigned by PIA.
For another service there is a separate write-up on when to enable and disable port forwarding in Proton VPN.
CitadelVPN subscription terms: incoming P2P connections
Frequently asked questions
Can a fixed port of 25565 be requested from PIA?
No. According to NAT Checker, PIA does not allow choosing your own forwarded port number, including 25565. The receiving application needs to be set up with the issued value.