Creating SSH Tunnels¶
This comprehensive guide covers creating different types of SSH tunnels using the SSH Tunnel Manager.
Understanding Tunnel Types¶
Local Port Forwarding¶
Concept: Forward a local port to a remote destination through an SSH server.
Format: ssh -L local_port:remote_host:remote_port user@ssh_server
Use case: Access services on a remote network that aren't directly accessible.
Remote Port Forwarding¶
Concept: Allow remote users to access your local services through the SSH server.
Format: ssh -R remote_port:local_host:local_port user@ssh_server
Use case: Share a local service with remote users.
Dynamic Port Forwarding (SOCKS Proxy)¶
Concept: Create a SOCKS proxy that routes traffic through the SSH server.
Format: ssh -D local_port user@ssh_server
Use case: Route all application traffic through the SSH server.
Step-by-Step Tunnel Creation¶
Creating a Local Port Forward¶
Example: Accessing a Web Interface¶
- Open Configuration Dialog
- Click "Add Tunnel" (➕) in the toolbar
-
Or use menu: File → New Tunnel
-
Basic Information
-
SSH Connection Settings
-
Tunnel Configuration
-
Save and Test
- Click "OK" to save
- Select the tunnel and click "Start"
- Access via
http://localhost:8080
Example: Database Connection¶
-
Configuration
-
Database Client Setup
Creating a Remote Port Forward¶
Example: Sharing Local Development Server¶
-
Configuration
-
Result
- Your local port 3000 is accessible at
public-server.example.com:8080 - Others can visit
http://public-server.example.com:8080
Creating a Dynamic Port Forward (SOCKS Proxy)¶
Example: Browsing Through SSH Server¶
-
Configuration
-
Browser Configuration
-
Firefox: Settings → Network → Manual proxy
- SOCKS Host:
localhost - Port:
1080 - SOCKS v5: Enabled
- SOCKS Host:
-
Chrome: Start with proxy settings
Advanced Configuration Options¶
SSH Key Authentication¶
Generating SSH Keys¶
- Using SSH Tunnel Manager
- Click "SSH Key Setup" in toolbar
- Follow the key generation wizard
-
Automatically deploys keys to servers
-
Manual Generation
Key Deployment¶
# Copy public key to server
ssh-copy-id user@hostname
# Manual deployment
cat ~/.ssh/id_ed25519.pub | ssh user@hostname "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Auto-Start Configuration¶
Enable tunnels to start automatically:
- Edit tunnel configuration
- Check "Auto-start on application launch"
- Tunnels will start when the application opens
Multiple Hops (Jump Servers)¶
For accessing servers through intermediate hosts:
-
First Tunnel (to jump server)
-
Second Tunnel (through first tunnel)
RTSP Video Streaming¶
IP Camera Access¶
-
Tunnel Configuration
-
Testing the Stream
- Start the tunnel
- Click "Launch RTSP" in toolbar
- Or use external player:
vlc rtsp://localhost:8554/live/0
Common RTSP URLs¶
The SSH Tunnel Manager automatically suggests common RTSP URL patterns:
rtsp://localhost:8554/live/0 # Generic
rtsp://localhost:8554/stream/0 # Alternative
rtsp://localhost:8554/cam/realmonitor?channel=1 # Dahua cameras
rtsp://localhost:8554/av0_0 # Some HIKVISION
rtsp://localhost:8554/axis-media/media.amp # Axis cameras
Configuration Import/Export¶
Exporting Configurations¶
- Individual Export
- Right-click tunnel in table
-
Select "Export Configuration"
-
Bulk Export
- Menu: File → Export Configurations
- Saves all tunnels to JSON file
Importing Configurations¶
- From File
- Menu: File → Import Configurations
- Select JSON file
-
Choose to overwrite or skip duplicates
-
From Another Installation
- Copy configuration files between systems
- Windows:
%APPDATA%\SSHTunnelManager\ - Linux:
~/.config/SSHTunnelManager/
Configuration Format¶
{
"version": "1.0",
"tunnels": {
"camera_rtsp": {
"name": "camera_rtsp",
"ssh_host": "192.168.1.1",
"ssh_port": 22,
"ssh_user": "admin",
"local_port": 8554,
"remote_host": "192.168.1.50",
"remote_port": 554,
"tunnel_type": "local",
"description": "Security camera access",
"auto_start": true,
"ssh_key_path": "/path/to/key",
"rtsp_url": "rtsp://localhost:8554/live/0"
}
}
}
Best Practices¶
Security¶
- Use SSH Keys: More secure than passwords
- Limit Key Access: Set proper file permissions (600)
- Regular Key Rotation: Update keys periodically
- Host Key Verification: Enable when security is critical
Performance¶
- Connection Limits: Don't create excessive concurrent tunnels
- Keep-Alive Settings: Use built-in keep-alive for stability
- Local Port Selection: Use ports above 1024 to avoid privilege issues
- Monitor Resources: Check system resources with many tunnels
Organization¶
- Descriptive Names: Use clear, descriptive tunnel names
- Grouping: Use naming conventions for related tunnels
- Documentation: Add meaningful descriptions
- Regular Cleanup: Remove unused configurations
Troubleshooting¶
Common Issues¶
"Connection Refused"¶
# Check SSH service
ssh -v user@hostname
# Verify port accessibility
telnet hostname 22
# Check firewall
# Linux: sudo ufw status
# Windows: Windows Defender Firewall settings
"Port Already in Use"¶
# Find process using port
netstat -tulpn | grep :8080 # Linux
netstat -ano | findstr :8080 # Windows
# Kill process if needed
kill -9 <PID> # Linux
taskkill /PID <PID> # Windows
"Permission Denied (publickey)"¶
# Check key permissions
chmod 600 ~/.ssh/id_rsa
# Test SSH connection
ssh -i ~/.ssh/id_rsa user@hostname
# Check authorized_keys on server
cat ~/.ssh/authorized_keys
"Tunnel Established but Service Unreachable"¶
# Test from SSH server
ssh user@hostname
telnet remote_host remote_port
# Check tunnel status
netstat -an | grep local_port
Debug Mode¶
Enable detailed logging:
- GUI Application
- View → Show Debug Log
-
Higher verbosity in settings
-
Command Line
-
SSH Verbose Mode
- Add
-v,-vv, or-vvvto SSH commands for debugging
Next Steps¶
- Managing Configurations - Organize your tunnels
- SSH Key Management - Advanced key handling
- RTSP Streaming - Video streaming specifics
- Troubleshooting - Detailed problem solving