Client
TCP Tunnel
Learn how to start a TCP tunnel with the Portr CLI to expose local databases, SSH, and other raw TCP services to the public internet.
Use the following command to tunnel a TCP connection:
TCP tunnels are useful for exposing services like databases, SSH servers, or any service that uses raw TCP connections.
How it works
TCP tunnels work differently from HTTP tunnels:
- Portr establishes a direct TCP connection between the remote client and your local service
- No HTTP processing is involved - raw TCP data is forwarded
- The connection is bidirectional and maintains the TCP session state
Common Use Cases
- Database access: Connect to local databases from remote applications
- SSH tunneling: Access local SSH servers from remote locations
- Custom protocols: Tunnel any service that uses TCP connections
- Legacy applications: Connect to services that don't use HTTP
Port Requirements
Your Portr server needs to have the port range 30001-40001 open to accept incoming TCP connections. Make sure your server administrator has configured these ports.
Configuration
TCP tunnels do not use subdomains — the server assigns a public port from the
30001-40001 range and prints the address when the tunnel starts. Define one
in the config file like any other tunnel: