Reducing SSH Login Delay¶
Setting UseDNS no
in the VM’s /etc/ssh/sshd_config
or /etc/sshd_config
has made it much faster to ssh into VMs.
centos@128.31.24.158 is a m1.small VM in Kaizen with a public IP.
With UseDNS yes
(the default in Ubuntu 16.04), ssh -A centos@128.31.24.158 'exit'
(ssh into the VM and then immediately exit) takes 5.8 seconds.
With UseDNS no
, ssh -A centos@128.31.24.158 'exit'
takes 248 ms.
So changing this option shaves 5.5 seconds off the time it takes me to ssh into a VM.
More info about the UseDNS option to see if you actually need it enabled:
To configure:
sudo vim /etc/ssh/sshd_config
orsudo vim /etc/sshd_config
- Change
UseDNS yes
toUseDNS no
or addUseDNS no
to the file, then quit vim - Restart ssh
sudo service sshd restart