Last active
December 30, 2022 12:25
-
-
Save vkhatri/9269335 to your computer and use it in GitHub Desktop.
Configure SSH Port Forwarding via .ssh/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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