It takes time to connect via SSH over local network


When connecting via SSH, server perform a reverse DNS lookup of client's IP address. However, when connecting inside local network and server or client do not have global IP address, it is impossible to perform DNS lookup, and server must wait for connection time out. Thus, connecting via SSH takes so much time.

There are two solutions to this problem. 
(both need changing setting on a server)

  1. Adding information about local IP address to the hosts file 

    Add the following to the /etc/hosts file: 
    [client IP address] [client host name] 

    E.g. When client IP address is and host name 

  2. Disable reverse DNS lookup in SSH settings 

    Change the following in /etc/ssh/sshd_config file: 
    #UseDNS yes 
    UseDNS no 

    After saving changes reload SSH settings using the following command 
    /etc/init.d/sshd reload
0 out of 0 found this helpful



Article is closed for comments.