This page contains helpful SSH commands I use to connect to my home network when I am not home.
Proxy SOCKS5: Tunnel internet through SSH (like a VPN)
To access internet as if I were at home, I can use a proxy SOCKS5 SSH tunnel to a Linux gateway. This is secure, just like using a VPN.
ssh -D 1337 -q -C -N gateway.example.com
Regarding options:
-D 1337
open the SOCKS proxy on local port 1337-C
compress the data in the tunnel-q
quiet mode, no output in the terminal-N
do not execute remote commands
The web browser (e.g., Firefox) needs to be configured to route traffic through the proxy. Only the internet traffic will go through the proxy.
Source: Create a SOCKS proxy on a Linux server with SSH to bypass content filters
Forward a port from another computer via a proxy VM
To access a service hosted on a VM on my home network (e.g., Microsoft RDP), I can forward the port for the service to my local computer via a SSH proxy using the Linux gateway.
(SSH proxy)
Me (on my laptop) ----------> Linux gateway VM ----> Windows VM
(office network) (home network) (home network)
For example, for forwarding RDP via a gateway:
ssh -L 3389:windows.example.com:3389 gateway.example.com
Source: Remote Desktop over SSH SOCKS proxy to bypass firewall