wiki:jazz/11-10-30

Version 1 (modified by jazz, 13 years ago) (diff)

--

2011-10-30

SSH port forward

  • <情境> 有些網路環境綁得很死,像是會擋 VNC (5800~59) 連線埠,這時候就只能用 SSH 穿牆術了~
  • <解法> 語法:ssh -L 5902:localhost:5901 user@…
      +-------------------+                      +-------------------------+
      |                   |          Firewall    |                         |
      |         vncviewer +-------------||       + 0.0.0.0:5901 vnc server |
      |                   |             ||       |                         |
      |        ssh client +-------------||-------+ 0.0.0.0:22   ssh server |
      |                   |             ||       |                         |
      +-------------------+                      +-------------------------+
           My Notebook                                   Remote Server
            localhost                               IP address : A.B.C.D
    
                                        |||
             on localhost               |||
         Run following command          |||
      'ssh -L 5902:localhost:5901       |||
            user@A.B.C.D'              VVVVV
                                        VVV
                                         V
    
      +-------------------+                      +-------------------------+
      |                   |          Firewall    |                         |
      |  + 127.0.0.1:5902 +===+         ||   +===+ 0.0.0.0:5901 vnc server |
      |  |                |   |         ||   |   |                         |
      |  |     ssh client +---+---------||---+---+ 0.0.0.0:22   ssh server |
      |  |                |             ||       |                         |
      |  +----- vncviewer |             ||       |                         |
      +-------------------+                      +-------------------------+
           My Notebook                                   Remote Server
            localhost                               IP address : A.B.C.D
    

Attachments (1)

Download all attachments as: .zip