SSH reverse tunneling: getting a static IP from a cloud
SSH reverse tunneling is a method of forwarding any type of traffic from a remove machine to your local laptop - so you can have, for example, AWS free tier with static ipv4/ipv6 - and calls to that IP will be forwarded to your laptop (and answers from your laptop back to the client). It can be useful if you want to share something directly from your laptop but you are behind NAT (most ISP have this - because of IPv4 address exhaustion) and without static IP at your home. Another direction - tunneling from your local laptop to remove machine is called SSH tunneling.
Server (remote with static IP)
Port 22
UsePAM yes
PrintMotd no
AcceptEnv LANG LC_*
AllowTcpForwarding yes
AllowAgentForwarding no
AllowStreamLocalForwarding yes
PermitTunnel yes
GatewayPorts yes
Client (your laptop)
How to connect without a config file:
user $
ssh -i key.pem -R <port-incomming>:localhost:<port-local> algo@xx.xx.xx.xx -p <for-for-connecting>
It can be simplier with config file that is supplied by -F
Host xx.xx.xx.xx
User user
Port 22
IdentitiesOnly yes
IdentityFile /path/to/key.pem
KeepAlive yes
ServerAliveInterval 30
RemoteForward 63368 localhost:8000
And now you command is shorter:
user $
ssh -F ssh_config_reverse_tunnel xx.xx.xx.xx
It works even if you connected to the same machine by VPN.
See also
https://serveo.net: SSH reverse tunneling as-a-service