大网数据广告活动
服务器运维问答

Creating a forwarded ssh connection from a middle machine

· 52CE 我爱测

I feel like I've tried every combination of the -L and -R flags with ssh and read a ton of very similar question, but can't make this work…maybe it's not possible. There are two machines, neither of which is accessible from the o…

问题原文

原帖链接 · ArtH · CC BY-SA 4.0

I feel like I've tried every combination of the -L and -R flags with ssh and read a ton of very similar question, but can't make this work…maybe it's not possible.

There are two machines, neither of which is accessible from the outside word: DB & Mid. DB is a database server listening on port 1433 (and only 1433). Mid can connect to it on 1433. I have terminal access to Mid. I would like to make DB port 1433 available to a third computer: Home. I can ssh from Mid to Home (but not Home to Mid).

It basically looks like this:

DB <--[1433]--> Mid --[ssh]--> Home

If there some way to create a connection from Home to DB via port forwarding in such a way that traffic flows through Mid and allows me to access DB port 1433 from Home?.

已采纳解答

原帖链接 · Tero Kilkanen · CC BY-SA 4.0

This should work when executed on Mid:

ssh -R 1433:DB:1433 user@Home

This creates a tunnel from port 1433 at the Home computer to DB server port 1433.

After this, you can connect to localhost:1433 with a program running on Home computer.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-06-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。