Overview
Undying Terminal supports two types of port forwarding to tunnel TCP traffic through your persistent session:Forward Tunnels (-t)
Client opens local port → forwards to remote destinationUse case: Access remote services locally
Reverse Tunnels (-r)
Server opens port → client connects to local destinationUse case: Expose local services remotely
Forward Tunnels
Basic Syntax
Examples
How Forward Tunnels Work
Tunnel Request Sent
Client sends
PORT_FORWARD_DESTINATION_REQUEST to server with:- Source:
localhost:8080 - Destination:
remote:9090 - Socket ID: unique identifier
Use Cases
Database Access
Database Access
Forward remote database to local port:Connect with local tools:
Web Development
Web Development
Access remote development servers:Access via browser:
http://localhost:8080Internal Services
Internal Services
Access services behind firewall:
Reverse Tunnels
Basic Syntax
Examples
How Reverse Tunnels Work
Client Connects Locally
Client establishes connection to specified local destination (e.g.,
localhost:8000)Use Cases
Development Webhooks
Development Webhooks
Expose local dev server for webhooks (GitHub, Stripe, etc.):Configure webhook URL:
http://remote-server.com:80/webhookDemo/Staging
Demo/Staging
Share local development with team:Team access:
http://remote-server.com:8080Remote Desktop / VNC
Remote Desktop / VNC
Access local machine from remote network:
Multiple Tunnels
Combine forward and reverse tunnels:Tunnel Syntax Reference
Format Options
| Syntax | Description | Example |
|---|---|---|
LOCAL:REMOTE | Simple: local port → remote port | -t 8080:9090 |
LOCAL:HOST:REMOTE | Explicit: local port → remote host:port | -t 8080:db:5432 |
BIND:LOCAL:HOST:REMOTE | Full: bind IP, local port → remote host:port | -t 0.0.0.0:8080:db:5432 |
START-END:START-END | Range: multiple ports | -t 8080-8085:9090-9095 |
Bind Addresses
| Address | Behavior |
|---|---|
localhost (default) | Only accessible from local machine |
0.0.0.0 | Accessible from any interface |
192.168.1.x | Accessible from specific interface |
127.0.0.1 | Explicit localhost |
Tunnel Persistence
Tunnels survive disconnects:Active connections through tunnels are not preserved during disconnect. However, new connections work immediately after reconnect.
Environment Variable Forwarding
Forward environment variables through tunnels:Troubleshooting
Tunnel not working - connection refused
Tunnel not working - connection refused
Symptoms: Local/remote service unreachableDiagnosis:
- Verify service is running:
- Check firewall rules
- Verify bind address (localhost vs 0.0.0.0)
Port already in use
Port already in use
Error: Solution:
bind: address already in useDiagnosis:- Choose different local port
- Kill process using the port
- Use specific bind address (not 0.0.0.0)
Slow tunnel performance
Slow tunnel performance
Symptoms: High latency, slow transfersCauses:
- Network bandwidth limitation
- Multiple packet hops
- Large recovery buffer replay
- Use direct network path when possible
- Reduce keepalive frequency
- Check network quality (ping, traceroute)
Tunnel breaks after reconnect
Tunnel breaks after reconnect
Expected Behavior: Active connections drop, new connections workExplanation: TCP connections can’t survive both endpoints changing. Undying Terminal restores the tunnel infrastructure, but application-level connections must be re-established.Workaround: Applications should implement reconnect logic
Best Practices
Security
- Use
localhostbind when possible - Enable encryption for internet-facing tunnels
- Restrict server firewall rules
- Use strong passkeys
Performance
- Minimize tunnel hops (use direct paths)
- Use port ranges for efficiency
- Monitor bandwidth usage
- Test latency impact
Reliability
- Design for reconnect (don’t rely on persistent connections)
- Use health checks in applications
- Log tunnel status
- Monitor connection stability
Organization
- Document tunnel mappings
- Use consistent port conventions
- Group related tunnels
- Version tunnel configurations