NAT SSH issues NAT SSH issues

Topic: NAT SSH issues

Post NAT SSH issues
by ebiscaia on Saturday, January 16, 2021

Hi,

As I took some time to type the original one and this page went to the home one, I am not sure if it was sent properly so I am pasting the original content below:

Hi,

I created a hostname, installed the client and after it I started having some odd behaviours:

- I can connect to all my computers locally using SSH (expected)
- Before I could connect to my computers remotely using
ssh user@public_ip -p port_number. I use NAT forwarding in my router. Just for the sake of clarity I'll use my windows machine as an example:
* private IP: 192.168.1.102
* NAT port: 2102 to 22 (screenshot attached)
* public IP: 123.456.789.000
* command: ssh eddie@123.456.789.000 -p 2102
Now, apart from one machine, this command does not work anymore. Here is the result when I use verbose mode:

ssh -vvv eddie@101.112.87.253 -p 2113
OpenSSH_8.3p1 Ubuntu-1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 101.112.87.253 is address
debug2: ssh_connect_direct
debug1: Connecting to 101.112.87.253 [101.112.87.253] port 2113.
debug1: connect to address 101.112.87.253 port 2113: Connection timed out
ssh: connect to host 101.112.87.253 port 2113: Connection timed out

For the machine that still works:
ssh -vvv eddie@101.112.87.253 -p 2109
OpenSSH_8.3p1 Ubuntu-1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 101.112.87.253 is address
debug2: ssh_connect_direct
debug1: Connecting to 101.112.87.253 [101.112.87.253] port 2109.
debug1: Connection established.
debug1: identity file /home/eddie/.ssh/id_rsa type -1
debug1: identity file /home/eddie/.ssh/id_rsa-cert type -1
debug1: identity file /home/eddie/.ssh/id_dsa type -1
debug1: identity file /home/eddie/.ssh/id_dsa-cert type -1
debug1: identity file /home/eddie/.ssh/id_ecdsa type -1
debug1: identity file /home/eddie/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/eddie/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/eddie/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/eddie/.ssh/id_ed25519 type -1
debug1: identity file /home/eddie/.ssh/id_ed25519-cert type -1
debug1: identity file /home/eddie/.ssh/id_ed25519_sk type -1
debug1: identity file /home/eddie/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/eddie/.ssh/id_xmss type -1
debug1: identity file /home/eddie/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3p1 Ubuntu-1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4
debug1: match: OpenSSH_8.4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 101.112.87.253:2109 as 'eddie'
debug3: put_host_port: [101.112.87.253]:2109
debug3: hostkeys_foreach: reading file "/home/eddie/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/eddie/.ssh/known_hosts:5
debug3: load_hostkeys: loaded 1 keys from [101.112.87.253]:2109
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
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
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:dFDt9/9dAObHG1kf3qM5fvs+F27k6azE1LTFBL+to2Y
debug3: put_host_port: [101.112.87.253]:2109
debug3: put_host_port: [101.112.87.253]:2109
debug3: hostkeys_foreach: reading file "/home/eddie/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/eddie/.ssh/known_hosts:5
debug3: load_hostkeys: loaded 1 keys from [101.112.87.253]:2109
debug3: hostkeys_foreach: reading file "/home/eddie/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file /home/eddie/.ssh/known_hosts:5
debug3: load_hostkeys: loaded 1 keys from [101.112.87.253]:2109
debug1: Host '[101.112.87.253]:2109' is known and matches the RSA host key.
debug1: Found key in /home/eddie/.ssh/known_hosts:5
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/eddie/.ssh/id_rsa
debug1: Will attempt key: /home/eddie/.ssh/id_dsa
debug1: Will attempt key: /home/eddie/.ssh/id_ecdsa
debug1: Will attempt key: /home/eddie/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/eddie/.ssh/id_ed25519
debug1: Will attempt key: /home/eddie/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/eddie/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/eddie/.ssh/id_rsa
debug3: no such identity: /home/eddie/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_dsa
debug3: no such identity: /home/eddie/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_ecdsa
debug3: no such identity: /home/eddie/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_ecdsa_sk
debug3: no such identity: /home/eddie/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_ed25519
debug3: no such identity: /home/eddie/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_ed25519_sk
debug3: no such identity: /home/eddie/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/eddie/.ssh/id_xmss
debug3: no such identity: /home/eddie/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
eddie@101.112.87.253's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to 101.112.87.253 ([101.112.87.253]:2109).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env COLORFGBG
debug3: Ignored env COLORTERM
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env DEFAULTS_PATH
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env DISPLAY
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env GTK2_RC_FILES
debug3: Ignored env GTK_RC_FILES
debug3: Ignored env HOME
debug3: Ignored env KDE_APPLICATIONS_AS_SCOPE
debug3: Ignored env KDE_FULL_SESSION
debug3: Ignored env KDE_SESSION_UID
debug3: Ignored env KDE_SESSION_VERSION
debug3: Ignored env KONSOLE_DBUS_SERVICE
debug3: Ignored env KONSOLE_DBUS_SESSION
debug3: Ignored env KONSOLE_VERSION
debug1: Sending env LANG = en_AU.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LANGUAGE
debug3: Ignored env LOGNAME

Reply with quote | Report
Post Re: NAT SSH issues
by ebiscaia on Tuesday, January 19, 2021

An update: It seems like I made a mistake when I said one machine could be connected. Actually, that machine was being connected when my phone was being a hotspot for the client. So my situation is the following:
- I can connect the server using its private IP if I am in the same network (expected)
- I can connect the server using its public IP and NAT forwarding if am out of its network (expected)
- I can't connect the server using its private IP if am out of its network (expected)
- I can't connect the server using its public IP and NAT forwarding if I am in the same network (unexpected and undesirable)

Thanks,

Eduardo

Reply with quote | Report
Post Re: NAT SSH issues
by ebiscaia on Friday, January 29, 2021

Guys,

I made a post on Solus forum providing more information. Here is the link:

https://discuss.getsol.us/d/6208-ddnssamba-issuesddclient-update

Thanks,

Eduardo

Reply with quote | Report
Thursday, December 26, 2024 4:10 AM
Loading...