Skip to content

Instantly share code, notes, and snippets.

@txoof
Last active January 16, 2020 16:45
Show Gist options
  • Save txoof/5effd09613bd4e5a33654381cfb1efbc to your computer and use it in GitHub Desktop.
Save txoof/5effd09613bd4e5a33654381cfb1efbc to your computer and use it in GitHub Desktop.
Multi-Hop SSH Forwarding - useful for web services behind firewall

Forward ports across multiple hosts to provide access to a remote machine

Configuration [remote] --ssh--> [DMZ Host] --ssh--> [host on LAN]

This will map port localhost:8888 on the remote machine port 8888 on the DMZ host; then port 8888 on the DMZ host to port 8888 on the LAN host:

$ ssh -t -p 22 -l user_dmz host_dmz.com  -L 8888:localhost:8888  ssh -t -p 22 -l pi lan_host.local -L 8888:localhost:8888 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment