SSH Port Forwarding or Ad Hoc VPN

ssh -i localkey -L local_port:localhost:remote_port user@ip

I had to look this up again. I haven’t had to use this in a while, maybe five years? I also wanted multiple ports forwarded, and that works like

ssh -i localkey -L local_port:localhost:remote_port -L local_port:localhost:remote_port user@ip

And… jenkins host inside remote VPC:

ssh -i catalyst -L 8080:localhost:18080 centos@bastion-host-ip

So, from my computer a connection to localhost:8080 forwards to my bastion host at 18080…

Then the bastion host forwards 18080 locally to my private addressed jenkins host at 8080…

ssh -i .ssh/catalyst -L 18080:localhost:8080 centos@private-addressing-for-jenkins-host

and…

Simple. Workable. When networking and firewalls and access lists and routing, oh my, stand in the way and need sorting, there’s alway a bastion host and ssh…

 

— doug