【问题标题】:Network connection timed out in AWSAWS 中的网络连接超时
【发布时间】:2016-03-11 19:09:18
【问题描述】:
即使凭据/ssh 密钥和安全组/防火墙设置正确,也会出现间歇性 ssh/网络连接错误。
SSH Error: ssh: connect to host 10.0.X.x port 22: Connection timed out while connecting to 10.0.X.X:22
【问题讨论】:
标签:
amazon-web-services
ssh
amazon-ec2
aws-security-group
【解决方案1】:
在 AWS 环境中,自动缩放发生得非常频繁,有时 IP 会被其他服务重用。您将收到连接错误,因为源服务器仍在 ARP 表中缓存旧的目标 IP 服务器/实例 MAC 地址。因此连接会失败,因为新的目的服务器的 MAC 地址与 ARP 表中缓存的 MAC 地址不匹配。
临时修复:
sudo sysctl -w net.ipv4.neigh.default.gc_thresh1=0
永久修复:
sudo vi /etc/sysctl.conf
net.ipv4.neigh.default.gc_thresh1 = 0
reboot