Skip to content

Instantly share code, notes, and snippets.

@znorris
Created January 18, 2018 19:59
Show Gist options
  • Save znorris/f00967eccc931557e29a4a92c548d806 to your computer and use it in GitHub Desktop.
Save znorris/f00967eccc931557e29a4a92c548d806 to your computer and use it in GitHub Desktop.
SSH Config Notes
# This config block will check if the current public IP of the host is 8.8.8.8
# If this is true, we can assume we're on the same network as our server, bob. In this case we should use it's local IP.
# If this is false, we can assume we're not on the same network as our server, bob. In this case we should use it's public IP.
Match OriginalHost bob Exec "curl -s 'https://api.ipify.org?format=text' | grep '8.8.8.8'"
Hostname 192.168.1.2
Host bob
Hostname 8.8.8.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment