O SSH vem com suporte para isso. Cito respostas de aqui :
according to the ssh man page, ProxyCommand is the correct method
the syntax being:
ProxyCommand ssh -W %h:%p user@jumphost 2> /dev/null
Ou, em um sistema suficientemente recente:
As of OpenSSH 7.3 (late 2016) the easiest way is the ProxyJump setting. In your
~/.ssh/config:Host B ProxyJump AOr on the command line, ,
-J B.
A última solução suporta até cadeias arbitrariamente profundas, consulte o guia vinculado.
Com o SCP, você não pode usar -J , então será assim:
scp -o "ProxyJump root@$IP1" root@$IP2:/var/log/message* /home/localuser/Desktop/MessageFolder/