且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SSH隧道复杂问题

更新时间:2023-01-20 07:42:00

请记住,从目的地的角度来看,您隧道传输到的地址(在您的情况下为server2:6667).例如:我有一个运行ssh的VPS.如果执行 ssh -f user @ vps -L 2000:localhost:3306 ,我可以连接到运行在它上面的MySql服务器(仅在回送接口上监听).

Remember that that address you tunnel to (server2:6667 in your case) is from the point of view of the destination. For example: I have a VPS running with ssh installed. If I do ssh -f user@vps -L 2000:localhost:3306 I can connect to the MySql server running on it (which is only listening on the loopback interface).

因此,假设IRC服务器在server2上运行,您应该这样做:

So assuming the IRC server is running on server2 you should do:

you@server1:~$ ssh -f you@server2 -L 2000:localhost:6667 -N

然后,您可以使用IRC客户端连接到localhost:2000(在server1上),并获得与在server2上运行的IRC服务器的连接.

You can then connect to localhost:2000 (on server1) with your IRC client and get a connection to the IRC-server running on server2.