Delay problem with SSH

From Notes_Wiki

Home > Network troubleshooting > Delay problem with SSH

There was delay problem while using SSH from one machine to another in same subnet. These machines were on VLAN created on private Layer 3 (4948) switch in IP range 172.16.31.0/255. Layer 3 switch was given IP address 172.16.31.1 for this VLAN. It is possible that default route was not configured on Layer 3 switch or reverse route for 172.16.31.0/24 pointing to this switch was not created. Hence these machines in 172.16.31.0/255 cannot contact machines in other network.

When default gateway for this machines was removed (172.16.31.1) then the SSH delay problem got solved. Hence it was suspected that during SSH nodes are trying to do reverse lookup for IP addresses through configured nameserver (nameserver was configured during network installation of OS, before nodes where shifted to this private VLAN). This resolution took 10-15 seconds to time-out and hence there was 10-15 seconds of delay in establishing SSH connection. Whether the switch was sending ICMP host/network unreachable message to these machines or not is not known.

To verify nameserver configuration was removed from '/etc/resolv.conf' and again default gateway was configured as 172.16.31.1. This time we did not face any delay problems confirming the suspicion that delay was caused by DNS reverse lookup.


Resolving delay problems in Ubuntu machines

Ubuntu tries to use mdns for DNS resolution. This causes significant slowness when one tries to use SSH from one local machine to another machine on LAN. To resolve this problem followings steps can be used:

  1. Open a terminal
  2. Open the file /etc/nsswitch.conf, for editing, in your favourite editor:
    sudo [your-favourite-editor] /etc/nsswitch.conf
  3. In the file, search for this line :
    hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
  4. Comment it, and add underneath it the line :
    hosts: files dns
  5. So finally, the file should look like this :
    # hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
    hosts: files dns

Now your ssh (in general) should become considerably faster.


Home > Network troubleshooting > Delay problem with SSH