ssh connection fails with timeout but telnet on port 22 is instant

1

I am trying to connect to an EC2 instance via ssh. I get a timeout after 80 seconds. If I telnet to the IP address using telnet. xxx.xxx.xxx.xxx 22 then I get an instant response. The EC2 instance is running a bitnami flavour of Ubuntu and I ssh using:

ssh -i keyname.pem bitnami@xxx.xxx.xxx.xxx

Intermittently, I am able to connect via ssh (randomly every couple of days I have been able to log in). Restarting the instance does not resolve the problem.

One theory is that the instance is under load due to the reasonably memory intensive processes I have running (phantomJS) but I would like to somehow be able to prove this before investing in a server with more memory (Currently using a free tier micro instance). However, the processes do still seem to be running as they are sending SMS messages via twilio successfully.

Can anyone suggest a way forward for isolating the problem?

ssh -vvv output:

debug1: Reading configuration data /Users/myname/.ssh/config
debug1: /Users/myname/.ssh/config line 18: Applying options for bitnami-servername
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com [xx-xxx-xxx-xxx] port 22.
debug2: fd 3 setting O_NONBLOCK
**Blinking Cursor**

codecowboy

Posted 2014-02-16T12:28:08.957

Reputation: 465

Thios kind of problem can have many causes, from MTU-settings to faulty hardware. Your first step should be to run the client with more verbose logging, i. e. ssh -vvv. – bjanssen – 2014-02-16T12:51:48.687

With instant response (with telnet), do you mean the SSH greeting line or just no timeout? – Jonas Schäfer – 2014-02-16T15:03:28.420

No answers