Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
601 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...