TARGET (within VPN) -- INTERMEDIATE -- LAPTOP
If you want to connect to TARGET and are not able to setup vpn from LAPTOP to TARGET. You can try RDP with the below setup via an intermediate server (in the cloud, or local server at home).
- run below in TARGET:
ssh -R $custom_port:127.0.0.1:3389 INTERMEDIATE
or
ssh -f -N -T -R $custom_port:localhost:3389 INTERMEDIATE
- run below in LAPTOP:
ssh -L 3389:127.0.0.1:$custom_port INTERMEDIATE
- access TARGET via rdp with below in LAPTOP:
localhost:3389
https://gist.github.com/edrex/a1c1325ff469b2ad5c13
https://superuser.com/questions/352268/can-i-make-ssh-fail-when-a-port-forwarding-fails
https://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work
ALTERNATIVES:
use vs code-server, if you don't need guis.
https://code.visualstudio.com/docs/remote/vscode-server
if you really need rdp, setup permanent tunnel with openssh and wsl2:
https://www.ibm.com/support/pages/set-permanent-ssh-tunnel-cron