SSH – Troubleshooting Connection Timeout Through Bastion Host

bastionlinuxSecurityssh

We have bastion server B. We need to SSH from A through B to C, using private key (we use keepass with keeAgent).

In the bastion I have: AllowTcpForwarding yes.

I tried to use proxyCammand:

Host app
    Hostname *.*.*.*
    User my-user
    Port 22
    ProxyCommand ssh -W %h:%p bast

Host bast
     Hostname *.*.*.*
     # ForwardAgent no
     User my-user

ssh app manages to enter the bastion server and falls when trying to connect the private server. The error is:

channel 0: open failed: connect failed: Connection timed out
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host

On the /var/log/secure log in bastion I see:

error: connect_to *.*.*.* port 22: failed.

Best Answer

I found the problem.

In app section I wrote public IP, as I did in Bast section, and as I'm always connecting.

Now I changed the IP to the private one and it works! I'm not sure why I can't connect via public IP. I used AWS Quick Start.