There is a server that cannot be connected to via SSH (port 22). Please consider these three servers all running CentOS 5.x:


  • server1 - SELinux enforcing
  • server2 - SELinux permissive
  • server3 - SELinux enforcing

SSH connectivity

  • server1 can access server1 and server3 via SSH but not server2
  • server2 can access server2 but not access server1 or server3
  • server3 can access server1 and server3 via SSH but not server2

Since server2 can access itself via ssh, it seems that ssh is properly working. From server2, the following have been tested or verified.

  • /etc/sysconfig/iptables has port 22 open, and is identical to the other servers.
  • verified that openssh-server and openssh-client is installed
  • verified that service sshd status is running with chkconfig on
  • used netstat -ptan and netstat -nlpa to verify that sshd is running with a pid
  • verified that SELinux is permissive
  • even attempted to connect with the firewall turned off: service iptables stop
  • reviewed various logs to determine if there is anything obvious that would not permit ssh access. Only can find messages that access is "Connection refused".

Is there anything else I should consider towards resolution, aside from upgrade to CentOS6 or are all the updates applied?

Thank you.

  • take a look at netmask on all servers and make sure it's set correctly.
    – alexus
    Apr 23, 2014 at 15:36
  • Have you tried using ssh -v? This would be one of the first steps to try in troubleshooting such an issue.
    – Erathiel
    Apr 23, 2014 at 15:50

2 Answers 2


Is Server2 on the same LAN as Server1 and Server2? If not, it's probably a network issue. I would put an SSH Client in the same network, on the same switch, as Server2 and work back from there. I would have asked in a comment, but this is a good troubleshooting step regardless of if it's applicable in this situation or not.

  • The servers are on different subnets. I tested others on the same subnet as server2 and each have the same issue. So, it maybe gateway or something else. But the issue became bigger than simply troubleshooting a single server to which I have access. I'll accept this answer.
    – canon
    Apr 24, 2014 at 21:13

"Connection refused" normally means that there's no server process listening on the TCP port which the client is trying to connect to. If Server2 can connect to itself, it seems the clients on server1 and server3 are trying to connect to an IP address and port which is different from what the the SSH server on that host is listening on.

Check the configuration file for sshd on server2. With OpenSSH, You're looking for ListenAddress or Port lines. You may find that it's set to listen only on the localhost interface, or the server is multihomed and it's listening only to one interface, or it's using a nonstandard port number (the standard SSH port is 22).

If the SSH server on server2 looks correct, check the client configurations on server1 and server3. Figure out what IP addresses and ports the clients are actually using to connect to the server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .