Skip to content

Instantly share code, notes, and snippets.

@vkhatri
Last active December 30, 2022 12:25
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vkhatri/9269335 to your computer and use it in GitHub Desktop.
Save vkhatri/9269335 to your computer and use it in GitHub Desktop.
Configure SSH Port Forwarding via .ssh/config
# Remote Gateway Node to Login to App Servers - 192.168.1.1
Host app_proxy1
Hostname 192.168.1.1
LocalForward 8080 192.168.1.100:8080
LocalForward 8081 192.168.1.101:8080
LocalForward 8082 192.168.1.102:8080
Host app_proxy2
Hostname 192.168.1.1
LocalForward 8090 192.168.1.100:8081
LocalForward 8091 192.168.1.101:8081
LocalForward 8092 192.168.1.102:8081
# Create aliases in .bashrc to ease session start/kill
alias app_proxy1="ssh -f -N app_proxy1"
alias app_proxy2="ssh -f -N app_proxy2"
# Start the session
app_proxy1
# Kill/Stop the session
pkill app_proxy1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment