Overview
Port forwarding mode allows you to create specific local→remote port mappings that forward traffic through the paqet tunnel. This is useful when you need dedicated ports for specific services or when applications don’t support SOCKS5 proxies.How Port Forwarding Works
Port forwarding creates a static mapping between a local port and a remote target:- Your application connects to a local port (e.g.,
127.0.0.1:8080) - paqet client receives the connection and forwards it through the tunnel
- paqet server receives the traffic and connects to the configured target
- All traffic flows bidirectionally through the encrypted tunnel
Configuration
Basic Port Forward
Add theforward section to your client configuration:
- Listens on local port
8080 - Forwards all connections to
127.0.0.1:80on the server side - Uses TCP protocol
The target address is resolved and connected to from the server, not from the client. This means
127.0.0.1:80 refers to the server’s localhost, not the client’s.TCP Forwarding
TCP is the default and most common protocol for port forwarding:- Database connections (MySQL, PostgreSQL, Redis)
- SSH tunnels
- HTTP/HTTPS services
- Any connection-oriented protocol
UDP Forwarding
UDP forwarding is also supported for connectionless protocols:- DNS queries
- VoIP/SIP traffic
- Gaming protocols
- Video streaming
- Any datagram-based protocol
Multiple Forwards
You can configure multiple port forwards simultaneously:Complete Client Configuration Example
Use Cases
Remote Service Access
Access services running on or accessible from the server:http://localhost:8080 to access the server’s web interface.
Database Tunneling
Securely access remote databases:localhost:3306 and it will tunnel to the remote database.
Private Network Access
Access services on the server’s private network:Development and Testing
Forward local development ports to test against remote services:Combining with SOCKS5
You can run both port forwarding and SOCKS5 proxy mode simultaneously:- SOCKS5 for flexible application-level proxying
- Port forwards for services that need dedicated local ports
Port Forwarding vs SOCKS5
| Feature | Port Forwarding | SOCKS5 |
|---|---|---|
| Configuration | Pre-configured targets | Dynamic targets |
| Flexibility | One local port = one target | Any target per connection |
| Application Support | Works with any application | Requires SOCKS5 support |
| Use Case | Specific services | General-purpose proxy |
| Setup Complexity | Simple | Requires app configuration |
Testing
Verify your port forward is working:Performance Considerations
- TCP: Connection-oriented, reliable, built-in flow control
- UDP: Lower overhead, better for real-time applications, no guaranteed delivery
- Multiple forwards: Each forward runs independently with minimal overhead
- KCP transport: Optimized for high-loss networks with aggressive retransmission
For latency-sensitive applications (gaming, VoIP), consider tuning KCP mode to
fast or fast2 in your transport configuration.