I need to create a tunnel from localhost to host2 through host1, so I'm using the approach suggested in this answer:
ssh -L 9998:host2:22 -N host1 ssh -L 9999:localhost:1234 -N -p 9998 localhostThis will open a tunnel from localhost to host1 through which the SSH service on host2 can be used. Then a second tunnel is opened from localhost to host2 through the first tunnel.
like this:
ssh -L 10022:host2:22 user1@host1
ssh -p 10022 -L 5678:host2:5678 user2@localhost
Is it possible to use ProxyJump approach here instead?
I could connect to the host2 with the jump like this:
ssh -J user1@host1 user2@host2
Update
Figured out how to do it:
ssh -L 5678:host2:5678 -J user1@host1 user2@host2