SSH Timeouts on GPU and AI Servers: Network, Bastion and Firewall Troubleshooting
ssh: connect to host ... port 22: Connection timed out means the TCP connection did not complete. It is different from Permission denied: authentication has not started yet.
For AI infrastructure, the target may be a GPU VM, inference host, Kubernetes node, bastion, or deployment machine. Diagnose the route without opening SSH globally.
Confirm the intended path
Record the hostname, resolved address, port, cloud account, network, and whether access requires a VPN or bastion.
ssh -vvv user@gpu.example.com
nc -vz gpu.example.com 22
Verbose output shows where the connection stops but may expose hostnames and usernames, so sanitize it before sharing.
Check reachability in order
- Confirm the VM is running and has the expected address.
- Verify DNS resolves to that address.
- Check the client network, VPN, and route.
- Inspect cloud firewall/security-group ingress.
- Inspect subnet ACLs and return routes.
- Confirm the server firewall and SSH daemon listen on the intended interface/port.
Avoid adding 0.0.0.0/0 to port 22 as a diagnostic shortcut. Allow only the approved source, or use a managed access path.
Bastion and private GPU hosts
Private GPU servers should often have no public SSH listener. Use a bastion or managed session service. An SSH config can make the route explicit:
Host gpu-prod
HostName 10.0.2.15
User deploy
ProxyJump bastion.example.com
IdentityFile ~/.ssh/ai-deploy
Test the bastion and private hop independently. Limit agent forwarding; a compromised remote host can misuse a forwarded agent during the session.
CI/CD access
Prefer short-lived credentials, workload identity, or managed deployment agents over a long-lived private key copied into CI. If SSH is required:
- use a dedicated least-privileged account;
- pin and verify host keys;
- restrict the source network and allowed commands;
- rotate keys and log access;
- never print the key or full connection config.
Read SSH host-key verification before automating first contact. How SSH works explains the security model.
Restore access safely
Use the cloud providerβs serial console, recovery console, or managed session channel if firewall or sshd changes locked everyone out. Do not repeatedly rebuild a production GPU host before checking attached model storage and workload ownership.
Link server access controls to AI Security, infrastructure design to AI Deployment & Hosting, and availability monitoring to AI Operations.
The correct fix restores the intended private path. It does not make a valuable AI server publicly reachable.