Link to home
Start Free TrialLog in
Avatar of rduval
rduvalFlag for Canada

asked on

Really SSLLOOWW connecting to Centos 5.1 using SFTP and.or SSH

I'm running a Centos 5.1 VM on VMware 1.0.4 using Win2003Server as host and they're both on the local network.

When I try to connect via SSH or SFTP, it DOES connect but it takes about 10-15 seconds to actually establish the link. Once established it works fine, no lags. Just on connection... Any Ideas?

and please be detailed, I'm a linux newbie...
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

It could be that it is due to reverse lookup for the ip you are connecting from

There should be  a reverse lookup zone in dns or you add the ip to /etc/hosts and edit the file /etc/nsswitch.conf and change the order of search:

hosts files dns
Look at the /etc/nsswitch.conf file. The 'host' should be like this:
"hosts:          files dns"
if not, change it.

Next, type 'who' command on linux box. You'll see something similar to this, one or more lines::

username  pts/4        2008-03-10 21:57 (some.IP.number)

the 'some.IP.number' is identification of the machine you did 'ssh' or 'ftp' command from. All you need is to add the line:

some.IP.number         name_of_your_linux_host

to /etc/hosts file. Assuming, you named your linux box eg. mylinux and IP you see in 'who' report is 192.168.1.5, it gives:

192.168.1.5     mylinux

This should solve your problem.

If you need more details, please reply.

Regards,

Marek
rduval, hi

As omarfarid said that most probably DNS problem. But instead of fixing DNS you may fix sshd config not to check DNS names, /etc/ssh/sshd_config:

UseDNS no

and restart sshd:

service sshd restart
Avatar of brycen
brycen

Might be reverse DNS, but you can't be sure with the given information.  Your #1 step should be to connect with:
   ssh -v user@server.net
which will give a log of the session, and you can easily see when the pauses are.  Upload that log here, and describe when the pauses happen.  Then run "nslookup" on the remote IP address.

If you're using passwords, not keys, key authentication is a delay you can do without.  Try connecting with:
ssh -v -o PubkeyAuthentication=no user@server.net

An example log "-v" log is attached.
hardhat> ssh -v bryce@xxxxxxxx.net
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to xxxxxxxxxx.net [76.244.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/brycee/.ssh/id_rsa type 1
debug1: identity file /home/brycee/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.6p1 Debian-5
debug1: match: OpenSSH_4.6p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'xxxxxxxxxx.net' is known and matches the RSA host key.
debug1: Found key in /home/bryce/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/bryce/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/bryce/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password

Open in new window

Avatar of rduval

ASKER

Wow that's a lot of replies and potential issues. I'' not be able to try them for a day or so, the box is being relocated to another facility.

One thing though re potential DNS poroblems, it's the same if I connect by IP.
ALso "putty" is what I'm using to connect.
> One thing though re potential DNS poroblems, it's the same if I connect by IP.

It doesn't matter how do you connect, it's sshd server tries to resolve your client IP.
With putty:
  plink -v
will give the same results as ssh -v
Avatar of rduval

ASKER

>It doesn't matter how do you connect, it's sshd server tries to resolve your client IP.
Nopius, I'm not sure I understand this? What is it looking for when It's already got the IP? The domain name? and if so, what for?

I can understand if it had a domain name and goes looking for the actual IP but can't understand the other way around?
Hi rduval,

I think I explained in my comment that it try to get the reverse lookup of the ip you are connecting from as it always get the ip and not the name. This is done for logging purposes and some times for trust connections etc.

ASKER CERTIFIED SOLUTION
Avatar of Arty K
Arty K
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial