Forwarding SNMP ports over SSH

networkingport-forwardingsnmpsocattunneling

I access my work network through a VPN and have access to every host in there through SSH. Currently I need to access around 3000 hosts via SNMP, but corporate sec policies restrict SNMP access through VPN, and can't make an exception due to technical difficulties.

Googling around I found a couple of options, such as ssh tunneling or forwarding traffic with socat (http://www.morch.com/2011/07/05/forwarding-snmp-ports-over-ssh-using-socat/), but those options are point-to-point and I need to set them up for each of 3000 hosts I have to access.

Is there something I can do to access all hosts via SNMP with a single configuration? I have root access to a linux box inside the network with full SNMP access, perhaps I can setup something there?

Thanks!

Best Answer

You can use SSH as a SOCKS4/5 proxy. Use a command like

ssh -D 8888 insidethevpn.example.com

Then configure your local workstation to use a SOCKS proxy (mac, windows, linux) with hostname localhost and port 8888. Your computer should now route all your network traffic through the SSH connection.