ssh: connect to host * port 22: Connection timed out
So in the end, it was a networking issue. Apparently, because I have accidentally ran yum update
, the system upgraded to CentOS 7.1. This server instance is running on OpenVZ which has a known network-related bug https://bugzilla.redhat.com/show_bug.cgi?id=1207975
The link also documents the fix:
--- ifup-aliases.orig 2015-04-01 08:46:08.179879018 +0200
+++ ifup-aliases 2015-04-01 08:46:52.558427785 +0200
@@ -261,7 +261,8 @@
is_available ${parent_device} && \
( grep -qswi "up" /sys/class/net/${parent_device}/operstate || grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then
echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..."
- if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then
+ /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR}
+ if [ $? = 1 ]; then
net_log $"Error, some other host already uses address ${IPADDR}."
return 1
fi
After making the changes (using the remote console) and restarting the server, it worked and I was already able to connect via SSH on my local machine.
Related videos on Youtube
Dynameyes
Updated on September 18, 2022Comments
-
Dynameyes over 1 year
I have CentOS 7 running on a VPS machine and after a computer restart, I could no longer SSH to it.
$ ssh -v <IP> OpenSSH_6.6.1, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to <IP> [<IP>] port 22. debug1: connect to address <IP> port 22: Connection timed out ssh: connect to host <IP> port 22: Connection timed out
I tried pinging but nothing.
$ ping <IP> PING sidious (<IP>): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1
traceroute outputs something but it never finishes, it ends up with
$ traceroute sidious traceroute to sidious (37.205.11.241), 64 hops max, 52 byte packets 1 192.168.1.254 (192.168.1.254) 0.664 ms 0.457 ms 0.457 ms ... 9 * * * 10 * * * 11 * * * 12 * * *
The thing is that, on the VPS admin site, I could log in on the console. I tried to make sure the SSH is up, and I believe it is.
I temporarily disabled iptables.
$ iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
Lastly, I also contacted the server administrator of my VPS if they can help on their end. But I am writing anyway if somebody can also help here.
I think it may be a network issue. Maybe I've accidentally affected it.
$ ss -tulpn Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp LISTEN 0 0 *:22 *:* users:(("sshd",420,3)) ... tcp LISTEN 0 0 127.0.0.1:25 *:* users:(("master",1367,13)) ... tcp LISTEN 0 0 :::22 :::* users:(("sshd",420,4)) ...
Any other thoughts how to troubleshoot this?
-
barlop about 9 yearsDo an online port scan.. or nmap -p22 <ip> of the ssh server. e.g. see if it says "open"
-