In some circumstances, it was necessary to use multistage SSH.
(It is bad that "ssh port 22 Operation timed out" comes out almost on AWS.)
- Create server1's private key.
- Create server2's private key.
Edit ssh config file.
Add the following parameters.
Host preserver HostName server2.com ForwardAgent yes User server2user-name IdentityFile ~/.ssh/server2key ProxyCommand ssh -l server1user-name -i ~/.ssh/server1key -p port-number server1.com -W %h:%p
ssh-add ~/.ssh/server2key ssh preserver