Thursday, 14 February 2019

Fix for SSH login takes 90 seconds!

So...  We type:

ssh user@host.example.com

and it hangs for ages before it lets you log in.

On older distros, you got a delay of around 30 seconds unless you set UseDNS=No in /etc/ssh/sshd_config but that's the default on recent OS installs e.g. Ubuntu Server 18.04.

I had a different problem... The DNS for host.example.com had both A and AAAA records, and somehow IPv6 was taking precedence over IPv4 - despite my machine having no working IPv6 route.  This led to a login delay of around 90 seconds before it finally fell back to IPv4.

Fix: 

ssh -4 user@host.example.com

Duh'oh!

No comments:

Post a comment

Spammers: please stop wasting my time. All comments are moderated before publication.