简体   繁体   English

如何在两个接口之间建立Telnet连接隧道?

[英]How can I tunnel Telnet connections between two interfaces?

I have the following network: 我有以下网络:

PC1 --|¯¯¯¯¯¯¯¯¯|                            |¯¯¯¯¯¯¯¯¯|-- board2
PC2 --| gateway |-- (eth0) [server] (eth1) --| gateway |
PC3 --|_________|                            |_________|-- board1

As you can see, the server (running Linux) has 2 interfaces so that the PCs and embedded boards are not on the same subnetwork. 如您所见,服务器(运行Linux)具有2个接口,因此PC和嵌入式板不在同一子网上。

I would like to develop a simple application (or use an existing one) that tunnels incomming Telnet connections from eth0 (using a specific port) to boards through eth1 . 我想开发一个简单的应用程序(或使用现有的应用程序),该应用程序通过eth1传入的Telnet连接从eth0 (使用特定端口)隧道连接到板。

I don't have root privileges on the server, but I have a regular Unix account. 我在服务器上没有root特权 ,但是我有一个普通的Unix帐户。 I don't want the PCs to actually "log in" to the server; 我不希望PC实际“登录”到服务器。 I just want them to pass through it to connect to the boards. 我只希望他们通过它连接到板。 The server has Python, PHP and Perl installed. 该服务器安装了Python,PHP和Perl。

I want to support multiple connections. 我想支持多个连接。 The port number could be used to forward the connection to the right board (say I have 10 boards, then the tunnel listens on ports 3000 to 3009). 端口号可用于将连接转发到右侧板(例如,我有10个板,然后隧道侦听端口3000到3009)。

I can imagine a simple Web application to do that, but I want a native Telnet connection that will support CTRL+C and all that stuff and allow you to use any terminal emulator on the PCs (ie PuTTY or another one), which run Windows. 我可以想象有一个简单的Web应用程序可以做到这一点,但是我想要一个本机Telnet连接,该连接将支持CTRL + C和所有其他功能,并允许您使用运行Windows的PC(例如PuTTY或另一台)上的任何终端模拟器。 。

Any help would be much appreciated. 任何帮助将非常感激。

It sounds like you're looking for a TCP proxy . 听起来您正在寻找TCP 代理 A proxy accepts connections on one port, connects to another ip/port, and then passes traffic back and forth. 代理接受一个端口上的连接,连接到另一个ip /端口,然后来回传递流量。

If you have xinetd on your system you already have what you need. 如果您的系统上有xinetd ,那么您已经拥有了所需的东西。 The redirect directive for a service causes xinetd to open a connection to another host/port and act as a proxy. 服务的redirect指令使xinetd打开与另一个主机/端口的连接并充当代理。 See this document for an example. 有关示例,请参见本文档

balance is another very simple proxy tool that will do what you need. 余额是另一个非常简单的代理工具,可以满足您的需求。 This is probably easier to run as a non- root user, especially since it's configured entirely on the command line. 作为非root用户,这可能更容易运行,尤其是因为它是完全在命令行上配置的。

Since you're not root on your server you'll need to run these on ports > 1024, but otherwise you should be all set. 由于您不是root ,因此需要在> 1024的端口上运行这些服务器,否则应该一切就绪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM