SSH tunnel manual login手工

Background 

Local behind firewall  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.

Local 192.168.137.200 is FRP client has connect 47.114.46.84:6004 already!

 

Requirement 

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   khadas@127.0.0.1
[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   khadas@127.0.0.1
[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 khadas@127.0.0.1
##################
登录该蜂鸟所对应的面板机器:打开浏览器,输入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")

lake@47.100.203.63

###################  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      khadas@127.0.0.1
khadas@127.0.0.1'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   lake@47.100.203.63
lake@47.100.203.63'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 ~]$
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值