Skip to content

Instantly share code, notes, and snippets.

@yosugi
Created April 10, 2013 23:50
Show Gist options
  • Select an option

  • Save yosugi/5359464 to your computer and use it in GitHub Desktop.

Select an option

Save yosugi/5359464 to your computer and use it in GitHub Desktop.
  • ssh
    • host1 - (FW) - host2 - host3
      • host2, 3 は同じネットワークにあるが host1 からは host2 しか見えない
    • host1:2034 に host3 の22をつなげる(host2 を経由)。 host1 で以下を実行する
      • ssh -i <キーのパス> -f -o ServerAliveInterval=60 -g -L 2034(ローカルのポート):host3:22 <host2 のユーザ>@host2
      • mysql にも使えます
      • ssh -N -i <キーのパス> -f -o ServerAliveInterval=60 -g -L 2306:host3:3306 <host2 のユーザ>@host2
    • host3 から host1 にログインする host1 の .ssh/config Host 2ndProxy Hostname Host3 ProxyCommand ssh -i <SSH_KEY> -R 3034:localhost:22 <host2ユーザ>@host2 ssh -g -L 4034:localhost:3034 localhost
    • 一旦 host1 の22 と host2 のローカル 3034 をつなげ、host2 のローカル 3034 と host2 のグローバル 4034 をつなげている
    • これで host3 から host2 の 4034 に ssh すれば OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment