I've changed ssh port number from 22 to 2222 The previous setup connection to default ssh port 22 is fine I've Mapped the NAT on the router correctly
When i try debug it
ssh -v -p2222 www.example.com
I get this error hanging
debug1: SSH2_MSG_KEXINIT
Below is all debug log
bob@server:~$ ssh -v -p2222 www.example.com
OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to www.example.com [100.100.100.100] port 2222.
debug1: Connection established.
debug1: identity file /home/bob/.ssh/identity type -1
debug1: identity file /home/bob/.ssh/id_rsa type -1
debug1: identity file /home/bob/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu1.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 100.100.100.100
Just like that connection get closed i used gnome-terminal, putty, securecrt on couple machines in and outside the network still all get the same error
I just had this happen to me on a XEN host. I had duplicated this host from another, and as is common practice, I deleted the host keys in /etc/ssh after doing this, thinking that new ones would be generated later. But this never happened, and sshd happily started up with no host keys. When attempting to ssh to this host, it would drop out after SSH2_MSG_KEXINIT. All I had to do was create the host keys, which on debian based machine is done this way:
I had the same issue, sshd got confused when I changed the port in sshd_config and restarted the sshd service, when I finally looked at the server logs (which it looks like you can't), sshd was complaining about the port already being in use, netstat agreed, and a ps showed several instances of sshd services running. I killed those and started sshd back up again, and was able to connect. I swear I tried rebooting to fix the problem but I guess not, because that would probably have fixed it.
Long story short, the sshd that should be listening on port 2222 to authenticate you is not the one actually listening, another sshd process is. If you have the same problem I did.
I had this problem and solved it by setting the MTU on destination router/firewall and in the destination host to the same as the source host (1500).
SSH2_MSG_KEXINIT is not an error. It's just telling you that it's beginning the ssh key exchange process.
If the other end is closing the connection at that point, apparently it doesn't like you for some reason :-) Do you have access to logs on the server you're connecting to? That may have information about why the connection is being shut down precipitously. (tcpwrappers, for example)