normally I use this kind of script (this is part of a larger bash script) to connect my pc to a static-ip pc and run a jupyter notebook remotely:
sudo fuser -k 8881/tcp echo 'Port 8881 is free now' ssh -N -f -L localhost:8881:localhost:8888 $username@$servername read -p 'SSH Tunnel created - Press enter to continue' ssh $username@$servername 'nohup jupyter notebook --no-browser --notebook-dir="$notebookdir"' wait echo 'Please, wait some seconds.' $nohup $browser http://localhost:8881/
And it works. But now I need to access a third pc that have a dynamic ip and I cant use services like dyndns. One good solution is to create a simple VPN like was done here SSH connection between two behind-nat computers through third public-ip computer.
This means that I have to do in the remote pc (dynamic-ip pc):
ssh -R 20000:127.0.0.1:22 user@RemoteHost
On my local pc (which also have a dynamic-ip):
ssh -L 8000:127.0.0.1:20000 user@RemoteHost
And finally, if I do:
ssh 127.0.0.1 -p 8000
This creates the "VPN". But now I'm a little lost on how to run the jupyter notebook forwarding a port in away that I can use the jupyter notebook of my remote pc on my local browser, using the remotehost with static-ip as a bridge.
Any suggestions or tips are welcome. Thank you.