====== 建立 SSH Tunnel 語法 ====== 這是兩年前寫在舊 blog 上面的紀錄, 剛好今天要用到, 所以就拉出來整理在這邊.. --- //[[tryweb@ichiayi.com|蔡宗融]] 2008/10/08 09:42// ==== - 透過遠端 InterServer-B 的主機連進來 IntraServer-A 的主機 ==== {{https://www.ichiayi.com/blog/images/ssh_tunnel/ssh_tunnel_1.gif}} * 先登入 IntraServer-A * 執行 ssh -nNT -R 9022:192.168.0.39:22 jonathan@61.67.71.95 * 由 IntraServer-A 以 jonathan 身分 ssh 連上 InterServer-B * 同時建立 ssh tunnel, 讓 InterServer-B 所 Listen 的 Port 9022 就是通到 IntraServer-A 的 Port 22 * 這時在 InterServer-B 內下 ssh engineer@localhost -p 9022 就可以由 InterServer-B 以 engineer 身分 ssh 連上 IntraServer-A ==== - 透過遠端 InterServer-B 的主機經 IntraServer-A 連進來 IntraServer-C 的主機 ==== {{https://www.ichiayi.com/blog/images/ssh_tunnel/ssh_tunnel_2.gif}} * 先登入 IntraServer-A * 執行 ssh -nNT -R 9022:10.1.1.2:22 jonathan@61.67.71.95 * 由 IntraServer-A 以 jonathan 身分 ssh 連上 InterServer-B * 然後建立 ssh tunnel, 讓 InterServer-B 所 Listen 的 Port 9022 就是通到 IntraServer-C 的 Port 22 * 這時在 InterServer-B 內下 ssh engineer@localhost -p 9022 就可以由 InterServer-B 以 engineer 身分 ssh 連上 IntraServer-C {{tag>ssh tunnel 密技}}