问题原文
原帖链接 · mac.1 · CC BY-SA 3.0
I have 3 Servers, A is a public accessable Server in the Internet. B Hosts a Webservice I want to access. C has access rights to connect to A and B.
Now i want that if a Client D tries to access a special Port on A that he gets forwarded to B.
IP's and Ports
A:
- 1.0.0.1:22 SSHD Server
- 1.0.0.1:443 Public Port which i want to use
B:
- 1.0.0.2:23 SSHD Server
- 1.0.0.2:444 Webservice I want to access
C:
- 1.0.0.3
D:
- 1.0.0.4
Diagram:
+------------+ +------------+
| Client (D) +--------> Public (A) |
+------------+ +-----^------+
|
+----------------+ +-----------+
| Webservice (B) <----+ Proxy (C) |
+----------------+ +-----------+
Question:
What ssh tunnel Commands do i need to execute on C so that if i try to open 1.0.0.1:443 on D i get the service hosted on 1.0.0.2:444 ?
已采纳解答
原帖链接 · kasperd · CC BY-SA 3.0
On C you can run
ssh -fNR 1.0.0.1:443:1.0.0.2:444 [email omitted]
It will only work if you login as root user because 443 is a privileged port. Moreover it only works if sshd on A is configured with GatewayPorts set to yes or clientspecified. (The default is no and using yes cannot be recommended, so if you want to do it this way I recommend clientspecified).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
