简体   繁体   English

网络设置更改后,Linux Debian SSH与另一台计算机的连接已延迟

[英]Linux Debian SSH connection to another machine has delay after network settings change

Hi StackOverflow members, 您好StackOverflow成员,

I have an issue with ssh connection on my Debian 7 system to a remote OpenSSH server located on the same network. 我在Debian 7系统上的ssh连接到位于同一网络上的远程OpenSSH服务器时遇到问题。 It looks like there is some network configuration problem but I cann't find where it lays. 似乎存在一些网络配置问题,但我找不到它的位置。 This two debian machines are connect with a switch that is NOT connected to a router. 这两个debian机器通过未连接到路由器的交换机连接。 So the two machines have no internet connection. 因此,这两台机器没有互联网连接。

A-Debian 7
IP: 192.168.1.2
MASK: 255.255.255.0
GW: 192.168.1.1

B-Debian 7
IP: 192.168.1.3
MASK: 255.255.255.0
GW: 192.168.1.1

With that configuration the ssh command prompts my for a password in less then a second. 通过这种配置,ssh命令会在不到一秒钟的时间内提示我输入密码。 But the with the following network configuration I get the password prompt after a 10+ second delay: 但是使用以下网络配置,经过10秒钟以上的延迟后,我得到了密码提示:

A-Debian 7
IP: 10.10.1.83
MASK: 255.255.255.128
GW: 10.10.1.1

B-Debian 7
IP: 10.10.1.82
MASK: 255.255.255.128
GW: 10.10.1.1

The ssh connection from the server A -> B runs with both configs on custom 1111 port. 来自服务器A-> B的ssh连接使用自定义1111端口上的两个配置运行。 The B machine has also a Web server running on port 8080 that has no delays with both net configurations. B机器还有一个运行在端口8080上的Web服务器,这两种网络配置都没有延迟。

Thank you in advance for any clues or tips how to solve that problem. 预先感谢您提供任何线索或提示来解决该问题。

SOLVED: Removing of the gateway parameter "GW: 10.10.1.1" in the network settings has solved the problem. 已解决:在网络设置中删除网关参数“ GW:10.10.1.1”已解决了该问题。

The usual culprits here are IPv6 and DNS lookups. 这里常见的罪魁祸首是IPv6和DNS查找。

SSH might try to connect via IPv6, first, but the timeout is too low for that. SSH可能首先尝试通过IPv6连接,但是超时时间太短了。 You can see whether IPv6 is enabled with 您可以查看是否启用了IPv6

cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6

To disable: 禁用:

echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6

The second culprit is DNS; 第二个罪魁祸首是DNS。 my guess is that DNS lookups don't work correctly with the second configuration. 我的猜测是DNS查找在第二种配置下无法正常工作。 Try host www.google.com to test this theory. 尝试host www.google.com来测试该理论。

If that also has a delay, you need to fix your DNS setup. 如果这也有延迟,则需要修复DNS设置。

If that's not it, check the rest of your networking parameters: Gateway, cables, etc. 如果不是,请检查其余的网络参数:网关,电缆等。

Start to ping the other host. 开始ping其他主机。 Is that fast & reliable? 这样快速可靠吗?

Next, try remote login ( ssh , telnet ). 接下来,尝试远程登录( sshtelnet )。 Note that you can give telnet a port to connect to, so if you have DB server running, you can still use telnet to connect to the server. 请注意,您可以为telnet一个要连接的端口,因此,如果您正在运行数据库服务器,则仍可以使用telnet连接至该服务器。 It will print an error but it allows you to test the TCP/IP connection without any extra error sources. 它将显示错误,但是它允许您测试TCP / IP连接而没有任何其他错误源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM