Assume that my server has 'my' ip. The client is a linux (debian) machine with ip 192.168.15.120. I tried from another machine (Windows) in the same subnet with ip 192.168.15.106. 'my' is a server in the internet with ip 195.xxx.xxx.xxx (certainly out of LAN). The Windows machine may ssh to my, while I (the linux client) can't. When in my server I changed the ssh port to 7822, my client could ssh to it. It seems that something with port 22 on my client is wrong. What's your opinion? How can I trace the problem and find it?
Update:
After running ssh -v my I got the following output:
debug1: Reading configuration data /home/hamidi/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to my [195.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/hamidi/.ssh/id_rsa type 0
debug1: identity file /home/hamidi/.ssh/id_rsa-cert type -1
debug1: identity file /home/hamidi/.ssh/id_dsa type -1
debug1: identity file /home/hamidi/.ssh/id_dsa-cert type -1
debug1: identity file /home/hamidi/.ssh/id_ecdsa type -1
debug1: identity file /home/hamidi/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/hamidi/.ssh/id_ed25519 type -1
debug1: identity file /home/hamidi/.ssh/id_ed25519-cert type -1
debug1: identity file /home/hamidi/.ssh/id_xmss type -1
debug1: identity file /home/hamidi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to my:22 as 'hamidi'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:GLEbQGgsPG4q1m5NpQpx1qgfGH+niS93ZQqz/m+amIM
The authenticity of host 'my (195.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is SHA256:GLEbQGgsPG4q1m5NpQpx1qgfGH+niS93ZQqz/m+amIM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'my,195.xxx.xxx.xxx' (RSA) to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/hamidi/.ssh/id_rsa RSA SHA256:XPZJP0PUv/cEg+Z0tsDL6sm8aTEkl/vt+ewJt/RwwH8 agent
debug1: Will attempt key: /home/hamidi/.ssh/id_dsa
debug1: Will attempt key: /home/hamidi/.ssh/id_ecdsa
debug1: Will attempt key: /home/hamidi/.ssh/id_ed25519
debug1: Will attempt key: /home/hamidi/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/hamidi/.ssh/id_rsa RSA SHA256:XPZJP0PUv/cEg+Z0tsDL6sm8aTEkl/vt+ewJt/RwwH8 agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/hamidi/.ssh/id_dsa
debug1: Trying private key: /home/hamidi/.ssh/id_ecdsa
debug1: Trying private key: /home/hamidi/.ssh/id_ed25519
debug1: Trying private key: /home/hamidi/.ssh/id_xmss
debug1: Next authentication method: password
hamidi@my's password:
debug1: Authentication succeeded (password).
Authenticated to my ([195.xxx.xxx.xxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-184-generic x86_64)
...