Intermittent getting ssh/network connection error even though credentials/ssh key and security group/firewall settings was correct.
SSH Error: ssh: connect to host 10.0.X.x port 22: Connection timed out while connecting to 10.0.X.X:22
Intermittent getting ssh/network connection error even though credentials/ssh key and security group/firewall settings was correct.
SSH Error: ssh: connect to host 10.0.X.x port 22: Connection timed out while connecting to 10.0.X.X:22
In AWS environment with autoscaling happened very frequent, sometimes the IP get reused by another service. You'll be getting connections error as the source server still caching the old destination IP server/instance MAC address in ARP table. So the connection will be failed as the new destination server's MAC address doesn't match with the MAC address cached in ARP table.
Temporary fix:
sudo sysctl -w net.ipv4.neigh.default.gc_thresh1=0
Permanent fix:
sudo vi /etc/sysctl.conf
net.ipv4.neigh.default.gc_thresh1 = 0
reboot