I am currently setting up my Linux system to make some daily tasks easier. I'd like to configure my SSH to be able to jump hosts using the terminal. I read about LocalForward as well as ProxyJump. The goal is to connect to the first server, tunnel the connection over it and then connect to the second server (as the second server is in a zone I can only reach from the first server).
Now what I did was the following snippet inside my ~/.ssh/config file:
Host tunnel
HostName <firstServer>
IdentityFile ~/.ssh/example.key
LocalForward 9906 <secondServer>:22
User helloWorld
If I now connect to the server using "ssh tunnel" I can successfully connect to the first server. If I now use telnet to check on the second server using "telnet secondServer 9906" I can see that SSH is running on it. If I now try to SSH into the second server using "ssh localhost:9906" I get the information that the hostname couldn't be resolved (same thing for 127.0.0.1:9906).
Afterwards I read about the option "ProxyJump" and tried the following:
Host tunnel
HostName <firstServer>
ProxyJump <secondServer>:22
User helloWorld
However, the connection never goes through. It gets stuck on "connection to ".
Am I missing something obvious here? Maybe I misunderstand the basic concept of the whole SSH forwarding thing? I am used to using Putty but I recently made the jump to Linux and would like to set everything up appropriately.
Best Answer
This ~/.ssh/config will ProxyJump through jump to the target, and bind a port all the way to target:
Usage: