SSH tunnel

Background 

192.168.137.0/  192.168.137.2~192.168.137.9   and  192.168.137.200

Internet Server/47.114.46.84  with FRP server/port 6004   for FRP client.

192.168.137.200 is FRP client

 

Internet Server/47.114.46.84 requires to access 192.168.137.2~192.168.137.9 


1.  Local forward   (“  -L"   tcp server  listen on Local/SSH client side")

[iot@yl-repo-2 ~]$ ssh -oPort=6004  -L 9902:192.168.137.2:80   [email protected]
[iot@yl-repo-2 ~]$ netstat  -an  --tcp  |grep  9902
tcp        0      0 127.0.0.1:9902          0.0.0.0:*               LISTEN


[iot@yl-repo-2 ~]$ ssh -oPort=6004  -L 0.0.0.0:9902:192.168.137.2:80   [email protected]
[iot@yl-repo-2 ~]$ netstat  -an  --tcp  |grep  9902
tcp        0      0 0.0.0.0::9902          0.0.0.0:*               LISTEN

#####################
ssh -oPort=frpc端口號  -L 0.0.0.0:9902:192.168.137.2:80 [email protected]
##################
登錄該蜂鳥所對應的面板機器:打開瀏覽器,輸入http://47.114.46.84:9902   =======>> 192.168.137.2:80
不需要遠程操作時,exit退出登錄


[iot@yl-repo-2 ~]$

[iot@yl-repo-2 ~]$ wget  127.0.0.1:9902
--2020-05-18 22:21:36--  http://127.0.0.1:9902/
Connecting to 127.0.0.1:9902... connected.
HTTP request sent, awaiting response... 302 Redirect
Location: http://127.0.0.1:9902/login.asp [following]
--2020-05-18 22:21:36--  http://127.0.0.1:9902/login.asp
Connecting to 127.0.0.1:9902... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                   ] 26,192      --.-K/s   in 0.02s

2020-05-18 22:21:36 (1.05 MB/s) - ‘index.html’ saved [26192]

[iot@yl-repo-2 ~]$


2. Remote    (“  -R"   tcp server  listen on Remote/SSH Server side")

[email protected]

###################  Note

/etc/ssh/sshd_config

AllowTcpForwarding yes        
GatewayPorts yes    ======>>>    0.0.0.0:9902 instead of 127.0.0.1:9902 
###################  Note


/etc/ssh/sshd_config

AllowTcpForwarding yes
GatewayPorts yes 

  

[iot@yl-repo-2 ~]$ ssh  -oPort=6004      [email protected]
[email protected]'s password:

Welcome to Fenix 0.8.3 Ubuntu 18.04.4 LTS Linux 4.9.206
 _  ___               _            __  ______
| |/ / |__   __ _  __| | __ _ ___  \ \/ / ___|
| ' /| '_ \ / _` |/ _` |/ _` / __|  \  /|___ \
| . \| | | | (_| | (_| | (_| \__ \  /  \ ___) |
|_|\_\_| |_|\__,_|\__,_|\__,_|___/ /_/\_\____/


 * Website:        https://www.khadas.com
 * Documentation:  https://docs.khadas.com
 * Forum:          https://forum.khadas.com

Last login: Mon May 18 22:20:46 2020 from 127.0.0.1
khadas@Khadas:~$ ssh    -R  0.0.0.0:9902:192.168.137.2:80   [email protected]
[email protected]'s password:
Last login: Mon May 18 22:20:51 2020 from 223.104.212.177

Welcome to Alibaba Cloud Elastic Compute Service !

[lake@izuf6ad1jbc6ftdqtbuiquz ~]$ netstat  -an  --tcp |grep  9902
tcp        0      0 0.0.0.0:9902            0.0.0.0:*               LISTEN
[lake@izuf6ad1jbc6ftdqtbuiquz ~]$ wget   localhost:9902
--2020-05-18 22:23:18--  http://localhost:9902/
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:9902... connected.
HTTP request sent, awaiting response... 302 Redirect
Location: http://localhost:9902/login.asp [following]
--2020-05-18 22:23:18--  http://localhost:9902/login.asp
Connecting to localhost (localhost)|127.0.0.1|:9902... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                       ] 26,192      --.-K/s   in 0.04s

2020-05-18 22:23:18 (598 KB/s) - ‘index.html’ saved [26192]

[lake@izuf6ad1jbc6ftdqtbuiquz ~]$
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章