Disable DNS lookup and speed up SSH login

SSHd is by default configured to perform reverse DNS Lookup everytime you connect to the server. This is especially true for CentOS/Red Hat and could significantly increase login time.

UseDNS Specifies whether sshd(8) should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The default is “yes”.

To fix this you'll have to disable the UseDNS option on the server via the following steps;

  1. Open SSHd config file.
    /etc/ssh/sshd_config
  2. Look for UseDNS and set the value to no
    UseDNS no
  3. Restart SSHd service

Sign up for Complete Secure Shell Course and many other great courses on Udemy to learn more.

Complete Secure Shell Course

This course is made for Linux admins who seek to secure their Linux work environment by mastering Linux SSH security!

Written by Mohd Shakir Zakaria.

Last updated on 2019-02-12.