ssh_exchange_identification:Connection closed by remote host

Forum Index » Forums » Applications
Author Message
Joined: Jun 21, 2007
Posts: 5
Other Topics
Posted Sep 26, 2008 at 2:49:23 PM
Subject: ssh_exchange_identification:Connection closed by remote host
i have a setup with about 30 Suse Linux Enterpise Server 10 Service Pack 1 machines and i have a backup script that in "pseudo code" looks like: for server in 1 to 30 do ssh $server tar -cz $logdir && scp $logdir.tar.gz $central_log_repo & done the problem is while all the servers get the logs tarred, the return trip doesnt allows work. random servers log this error: ssh_exchange_identification: Connection closed by remote host where of course remote host is the $central_log_repo. there is no mention on $central_log_repo of any attempt by the offending server(s) in summary, on one run server5 could scp the tarfile to $central_log_repo and on another it might fail because of the ssh error. how do i fix this?
Back to top Profile Email
Egyptian
Joined Jun 21, 2007
Posts: 5

Other Topics
ps. i have also seen the problem when i use [url=http://sourceforge.net/projects/clusterssh/l]clusterssh[/url] to manage these 30 servers. sometimes i do a "scp $central_log_repo/file /tmp/." and in this case the same error shows up. also on random servers and also not always on the same server 2 times in a row.
Back to top Profile Email
Agony
Joined Sep 27, 2008
Posts: 2

Other Topics
I'm by no means an expert but you could try using only one SSH connection per PC, as it stands you use one to ssh into a server and another to transfer a file. ssh $server 'tar c $logdir' > $logdir.tar you could pass it through gzip too to optain a tar.gz like you had before(too lazy to try that myself though) You might also wanna try waiting for one transfer to finish before starting up another... who knows, it might be multiple connections happening too fast that's messing up things for you.
Back to top Profile Email Website
Egyptian
Joined Jun 21, 2007
Posts: 5

Other Topics
i'd rather fix the cause rather than the symptom. it is obvious the script isnt the problem as seen by the fact that it also affects clusterssh usage. so if it is "multiple connections happening too fast that's messing up things" - i'd rather fix that but i cant find the setting anywhere, not in sshd_config (which uses the default that case with sles10 sp1) nor in net.core.ipv4 nor iptables. anywhere else?
Back to top Profile Email
Agony
Joined Sep 27, 2008
Posts: 2

Other Topics
[quote=Egyptian]i'd rather fix the cause rather than the symptom. it is obvious the script isnt the problem as seen by the fact that it also affects clusterssh usage. so if it is "multiple connections happening too fast that's messing up things" - i'd rather fix that but i cant find the setting anywhere, not in sshd_config (which uses the default that case with sles10 sp1) nor in net.core.ipv4 nor iptables. anywhere else?[/quote] I do not know. I'm by no means a network guru, but the command I gave you halves the ssh connections you need for this operation so it is the Right Thing(tm) to do anyway(you only need an outgoing connection from your central repository, an ssh connection is bidirectional). I can't do tests on this issue because I only have three PCs here at home to play with, but if you want to test if it's too many connections happening at the same time that's causing the problem just have the script sleep for a few seconds between the ssh calls.
Back to top Profile Email Website
linuxdynasty
Joined Aug 07, 2007
Posts: 47

Other Topics
Posted: Sep 29, 2008 12:44:33 PM
I have seen this issues on multiple occasions in the past, though has been for numerous reasons. 1st reason, the version of sshd we were using needed to be patched under RHEL3. 2nd reason, Firewall configuration. Obviously the firewall is not your issue. 3rd reason, our switches were not configured correctly so they were dropping packets ( Could be your issue ), 4th reason, your eth network interface might be dropping packets or is misconfigured with duplex or speed settings. I hope this might help a bit... http://linuxdynasty.org Where IT pros come and share their knowledge ..\
Back to top Profile Email Website
work.dhk@gmail.com
Joined Sep 29, 2008
Posts: 1

Other Topics
Sounds like sshd_config MaxStartups issue. sshd defaults to maximum of 10 simultaneous sessions that have not yet authenticated. I imagine it is a security feature so someone can't open a large number of brute force sessions. Note that, as soon as a connection is authenticated, it no longer counts against the MaxStartups limit. Assuming your script works for around 10 but not many more than 10 servers, this could be the cause. You could try increasing the MaxStartups amount. Or stagger your connections. Search the sshd_config man page for MaxStartups. Google for terms ssh_exchange_identification and MaxStartups to see references. E.g., http://archive.netbsd.se/?ml=openssh-unix-dev&a=2007-10&t=5430083
Back to top Profile Email Website
Egyptian
Joined Jun 21, 2007
Posts: 5

Other Topics
solution found at : http://archive.netbsd.se/?ml=openssh-unix-dev&a=2007-10&t=5430083
Back to top Profile Email
Forum Index » Forums » Applications