栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

tcp端口转发

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

tcp端口转发

Windows

PortProxy 是一个Windows本地端口转发管理工具,使用了Windows内置命令netsh。

Linux

现假定host A可建立到host B的ssh连接。
既可以使host A上端口P1的数据,通过A–>B的ssh隧道,到达host C的端口P2,这称为本地端口转发。
也可以使host B上端口P1的数据,通过B–>A的ssh隧道,到达host C的端口P2,这称为远程端口转发。

-L listen-port:host:port	Forward local port to remote address
-R listen-port:host:port	Forward remote port to local address
	These cause ssh to listen for connections on a port, and
	forward them to the other side by connecting to host:port.
-N	Do not execute a shell or command.
-f	Fork into background after authentication.
-g	Allow remote hosts to connect to forwarded ports.

举例:想让服务器10.6.8.12将2022端口上的请求转发至22端口,这样也能通过2022端口ssh连接了。
ssh -gL 2022:localhost:22 10.6.8.12
不加-g,会在127.0.0.1:2022上监听,加了-g,会在0.0.0.0:2022上监听。
这条命令会同时登陆到服务器上,登出时隧道也关闭,如果想让其在后台运行,加上-fN参数。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/962302.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号