I want to connect to Server A which is behind a NAT and a firewall which blocks all incoming connections. I want to access port 9000. In my office I have a public IP and control of the router. My idea is to run autossh on Server A which establishes a tunnel to Server B in my office. Then use another autossh tunnel to go back and forward port 9000 to 9001. I feel like I'm halfway there.
On the remote server, I have a systemd service running:
autossh -M 0 -q -N -p 22 -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -R :2222:localhost:22 email@example.com
Now I can connect to Server B from my laptop with
ssh firstname.lastname@example.org -p 2222
I'm trying to forward the port like this:
ssh email@example.com -p 2222 -L :9001:localhost:9000 -N
So now I expect I can connect from my laptop to 192.168.1.10:9001 but I get connection refused.