We have two machines: master and agent. The goal is for agent to ssh into master, allocating a local port on master which forwards to a port on agent.
In this example, we'll use ssh - but that's arbitrary. The "master" is lightning
and the "agent" is fabulinus
.
First: open the ssh connection:
sauer@fabulinus:~$ ssh -Nf -R 10022:localhost:22 lightning
This will fork ssh into the background (-f
) and not run a program (-N
). Thus, it's just forwarding the port and nothing else.