[已解决][阅读下面的答案]以某种方式 ping IP 地址导致Request timeout
,这意味着客户端和服务器端点之间的连接存在问题。感谢user68186帮助我追踪问题,非常感谢!
我刚刚升级了 Ubuntu 服务器,从 14.04 到 16.04。
ssh
服务已在服务器中启动。
升级后,我无法通过 SSH 连接到服务器。
我正在使用自定义端口,说它是 1234
sshd_config logLevel
已设置为DEBUG3
,最高级别。
我试图检查auth.log
文件,但它没有发现任何东西。
已经在iptables
:
iptables -I INPUT -p tcp --dport 1234 -j ACCEPT
ssh -vvv
从显示此消息的客户端执行:
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/username/.ssh/config
debug1: /Users/username/.ssh/config line 74: Applying options for target_server
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug2: resolve_canonicalize: hostname 192.1.2.3 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.1.2.3 [192.1.2.3] port 1234.
debug1: connect to address 192.1.2.3 port 1234: Operation timed out
ssh: connect to host 192.1.2.3 port 1234: Operation timed out
ssh localhost
从客户端执行产生:
Password:
Last login: Wed Feb 5 00:34:54 2020 from 127.0.0.1
Agent pid 22321
Identity added: /Users/username/.ssh/id_rsa (/Users/username/.ssh/id_rsa)
任何线索?
[已解决]终于找到根本原因了。
看来 iptables 配置在升级过程中被重置了。
在这样iptables -I INPUT -p tcp --dport 1234 -j ACCEPT
的顺序放在传入 IP 阻止规则之后,它将阻止对服务器的任何传入访问。
我通过重置iptables并进行了正确的配置来修复它,问题解决后,任何人都可以通过ssh连接。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句