SSH能直接建立一个本地到内网的隧道嘛?

SSH能直接建立一个本地到内网的隧道嘛?

远程端口转发主要用于让外部人员访问内部服务。

本地端口转发:

Port Forwarding – Support Portal (termius.com)

SSH port forwarding can be used to gain or provide access to services that are not directly reachable, to encrypt connections between different applications and more.

Termius supports all types of port forwarding: local, remote and dynamic.

Local port forwarding

Local port forwarding is most commonly used for connecting to services on a private network, such as a database or VNC server.

This type of port forwarding redirects connections made to a port on your device (e.g. by a browser) running Termius to a device running an SSH server and then to any reachable port / device.

有三台设备

image-20231121164606827

解决的问题:

1、在local通过A服务器(安装了SSH),访问B服务器

ssh -L 127.0.0.1:3336(local):10.1.30.42:3306(A服务器) daniel@daniel.local(B服务器)

Remote port forwarding

image-20231121164930582

在命令行上运行下边的指令:
ssh -R 【目标服务器的IP】:8899:【远程服务器的IP】:22 【目标服务器的用户名XXXX】@【目标服务器的IP】

PS: 目标服务器就是本地的服务器;

远程的服务器就是内网的服务器;

简单理解:

==把左右手连接起来。左手是一台服务器。右手是一台服务器。两者之间不能直接通讯,但是都能访问中间的服务器。==


image-20231121170237856

vrYl4JTKw1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值