Troubleshooting slow SSH connections to ESXi hosts
A slow SSH connection to an ESXi host can be misleading: the vSphere Client may look healthy while a terminal stalls during DNS, TCP, key exchange, authentication or shell startup. The first job is to identify the stage that consumes time, rather than repeatedly restarting SSH or changing keys.
A layered test works well in Australia, where home labs, branch offices and hosted environments use very different paths. NBN FTTN, FTTP and fixed wireless can behave differently from a metropolitan connection, while an administrator in Perth or Adelaide may be working across a much longer route to Sydney or Melbourne infrastructure.
Locate the delay before changing settings
Run ssh -vvv -o BatchMode=yes -o ConnectTimeout=10 root@esxi.example.au from the affected client and capture the elapsed time with Measure-Command in PowerShell or time in Bash. BatchMode removes password prompts, while ConnectTimeout prevents an indefinite TCP wait. Repeat with -T and a harmless command such as uptime to test remote execution without a pseudo-terminal.
Interpret the timestamps between Connecting to..., the server banner, key exchange, Authenticated and the first prompt. A pause before the banner points towards name resolution, routing or interception; a pause after authentication points towards PAM, directory services or shell startup.
Compare one clean session with the client’s normal path, noting any ProxyJump, ProxyCommand or reused multiplexing socket. Record the exact command, source address and elapsed time so the result can be reproduced. The same layered method appears in the Virtxpert resource library when further operational context is useful.
Test routing, DNS and packet size
For an Australian home lab, first establish whether the delay occurs before or after TCP establishment. Many NBN connections sit behind CGNAT, use dynamic addressing or block unsolicited inbound traffic, so exposing port 22 directly may be impossible and unsafe. This pattern explains a timeout before the banner, but not a delay after it. An outbound VPN to the home router or a supported gateway can provide a controlled management path instead.
Managed WANs commonly sit behind corporate VPNs, SSH proxies or firewall inspection, even when the carrier is Telstra, Optus or iiNet. Test from the same subnet and compare a direct TCP check with nc -vz -w 5 esxi.example.au 22. Sydney and Melbourne cloud regions may also use different egress paths and identity providers from on-premises hosts.
Test forward resolution with getent hosts or Resolve-DnsName, query the ESXi name’s PTR record and compare IPv4 with IPv6 using ssh -4 and ssh -6. Check MTU because a VPN or encrypted overlay can drop large packets without stopping smaller ones. Linux ping -M do -s 1400 can expose the issue. ICMP filtering still makes traceroute incomplete, so combine route traces with packet captures and application-level timings.
Inspect ESXi authentication and startup
Check the host before changing SSH settings. In vSphere Client, review tasks, alarms, storage latency, memory pressure, clock synchronisation and management services. A saturated management datastore can delay authentication even when the network path appears clean.
Review /var/log/auth.log and shell-related messages in /var/log/shell.log, where available. Look for unreachable domain controllers, PAM timeouts, account lockouts and bursts of half-open sessions. Repeated client retries can worsen a pre-authentication backlog, especially when the management interface is exposed to the internet.
Once authentication completes, use ssh -T esxi.example.au uptime to separate command execution from an interactive shell. A slow MOTD, profile script or shell hook can stall the first prompt. If storage latency also delays VM startup, correlate the host evidence with broader VM boot troubleshooting before blaming SSH.
Apply fixes that survive reboots
Use a host-specific client override to separate persistent options from the diagnostic test. For example:
Host esxi-lab
HostName esxi.example.au
ConnectTimeout 10
ServerAliveInterval 30
ServerAliveCountMax 3
ControlMaster no
ConnectTimeout bounds the initial connection, the keepalive settings detect a broken path after connection and ControlMaster no avoids a stale reused session. Keepalive timers do not speed up initial key exchange; they make a later stall easier to distinguish.
On ESXi, use Host Client or supported vSphere workflows to correct DNS, firewall and SSH service settings. If reverse lookup is the proven delay and the installed build documents the option, compare a temporary UseDNS no setting before making it persistent. Do not edit /etc/ssh/sshd_config casually, because upgrades can overwrite unmanaged changes and generic OpenSSH advice may not fit ESXi.
Limit SSH access to a management VLAN or approved jump host, and schedule service changes around Australian support and maintenance windows. Keep firewall rules specific to management sources rather than allowing broad internet access.
Deploy a repeatable SSH response plan
A useful runbook gives both the engineer at the console and a remote colleague a shared sequence. Readers can also review Jonathan Frappier’s background for context on the site’s practical focus.
Fast triage for Australian administrators
Symptom checks
- Note the final verbose log line before the stall.
- Capture DNS answers, source IP and route.
- Compare the affected client with the approved jump host.
- Review ESXi alarms, authentication failures and lockouts.
Action sequence
- Change one DNS, MTU or SSH variable per test.
- Apply host changes through a supported persistent workflow.
- Retest from an affected Australian site and a control client.
- Attach commands, timings and logs to the incident.
Compare symptoms and likely causes
Use the symptom map to select the next action:
| Observed behaviour | Most likely layer | Next diagnostic step |
|---|---|---|
Delay before the SSH-2.0 banner |
DNS, routing or firewall | Resolve A and AAAA records, test TCP port 22 and inspect the route |
| Banner arrives, but key exchange stalls | MTU, inspection or algorithm compatibility | Compare packet sizes and client versions, then capture the handshake |
Authenticated appears, but the prompt is late |
PAM, directory service or shell startup | Check authentication logs, reverse DNS and startup scripts |
| Only the jump-host path is slow | Proxy, identity provider or control socket | Compare the direct path where policy allows and inspect proxy settings |
| Sluggish only under host load | Storage, memory or pre-authentication pressure | Review alarms, management services and half-open session counts |
Deploy the sequence now: save the verbose command, use the symptom map during each incident and require a successful test from both the local management path and the approved jump path. Keeping the evidence with the change request turns intermittent SSH latency into a measurable fault window rather than a guessing game.