2

I'm working on a Java application that collects various bits of information on network devices. All these devices are behind a network bastion, and I use JSch to create TCP tunnels to the remote devices on demand. This works well for protocols like TL1 that are TCP based. However I do find myself needing to collect SNMP data as well.

The bastion server I have access to is rather old and limited, and I don't have a lot of options to build a SNMP Proxy over there. My question is if the community knows a clean, reliable way of programmaticly establishing tunnels as needed. I've looked at solutions such as this one, but as I have thousands to potentially tens of thousands of possible ip addresses, a manual one-off method is nonviable. If need be, I'll push for a server capable of doing a robust snmp proxy, but I need to know there is no other way before I fight that battle.

4

2 回答 2

3

SSH 协议不包含任何用于 UDP 转发的内容。

所以你需要在 SSH 服务器端运行一些程序,它会为你发送 UDP 数据包,并接收发送的数据包。

我不知道 SNMP 的详细信息,但对于简单的情况,您可以简单地启动netcatsocat使用 exec 通道,通过标准输入/标准输出发送数据包。

我想这样的事情可以做到:

netcat -u server 161 

或与socat

socat STDIO UDP:server:161
于 2011-07-29T20:40:57.733 回答
1

要将 udp:server:3200 转发到当前机器,请执行以下操作:

socat SYSTEM:"ssh server socat - udp\:127.0.0.1\:3200" udp-l:3200,fork,reuseaddr

请注意,在使用隧道之前,必须打开并监听 surver 上的 udp 端口​​ 3200。

于 2015-03-05T11:34:24.513 回答