Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
607 views
in Technique[技术] by (71.8m points)

portforwarding - Forward outgoing ssh connection port

Here is my use case:
We have a list of applications running in containers and the ssh ports of each container is randomly assigned. My test script uses a single port value (22 by default) to access all containers (more than obvious it is not gonna work). I am thinking of a workaround that maintain a port mapping table, so that the script can always ssh to remote host with port 22, while with some script/software the connection is forwarded to the real port mapping table. My question is how can I do this forwarding easily?
Naturally I was thinking of using ssh tunnelling, however I can't find a good example of my use case. Most of the usage of tunnelling is about walking around the firewall.
local laptop--> host1:22 -> forwarding to host1:123
???|-------> host2:22 -> forwarding to host2:234
Appreciate if anyone can shed some light on this or show me some existing question which is equivalent but I was not aware of.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...