Skip to content

Instantly share code, notes, and snippets.

@zhiguangwang
Last active December 22, 2020 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zhiguangwang/e693c18bc6aa9676106d1f8b209b21ef to your computer and use it in GitHub Desktop.
Save zhiguangwang/e693c18bc6aa9676106d1f8b209b21ef to your computer and use it in GitHub Desktop.
SSH Tunnelling
ssh-tunnel() { nohup ssh -o ServerAliveInterval=15 -f -N -L ${1}:${2} ${3} > /dev/null 2>&1; }

Usage

ssh-tunnel <local-port> <remote-host>:<remote-port> <bastion>

Example

ssh-tunnel 8080 127.0.0.1:8080 ubuntu@ec2-53-84-19-75.cn-north-1.compute.amazonaws.com.cn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment