我正在尝试通过 ssh 连接到我的工作站。我已启动 ssh 服务器并将端口 22 转发到该特定机器的私有 IP。我目前能够通过 ssh 连接到该工作站服务器远程。现在的问题是当我在同一个网络上尝试 ssh 进入该机器时。使用
ssh -vvvv [email protected]
我得到:
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/ddong/.ssh/config
debug1: /home/ddong/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "mydns.duckdns.org" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to mydns.duckdns.org [192.XXX.XXX.XXX] port 22.
debug1: Connection established.
debug1: identity file /home/ddong/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ddong/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
它只是挂在那里。没有错误消息。(如果我让它运行更长时间,可能会出现连接超时。)
只有在使用笔记本电脑从本地网络 ssh 时才会出现此问题。我先尝试从笔记本电脑 ssh 到其他地方的远程计算机,然后再 ssh 到此工作站,这样就可以了。另一个可行的方法是在 ssh 之前连接到 VPN。最后,另一个可行的方法是使用私有 IP 而不是公共 IP 进行 ssh。
理想情况下,我总是可以使用公共 DNS,因为无论我身在何处,我都可以使用该 DNS。
任何有关此事的帮助都将不胜感激。