Skip to content

Instantly share code, notes, and snippets.

View aztec102's full-sized avatar

Konstantin Mikholap aztec102

View GitHub Profile
@n-st
n-st / snmp-tunnel.sh
Last active December 3, 2022 18:07
Forward SNMP requests over a SSH connection (e.g. for use with Observium or other monitoring tools).
#!/bin/bash
# This script will make a local SNMP server accessible on a remote system by
# forwarding its UDP traffic over an SSH connection.
# To do this, the following port forwardings are applied (in this order):
# - local TCP port 42061 (arbitrary) to local UDP port 161 (SNMP)
# - remote TCP port 42061 to local TCP port 42061 (via SSH connection)
# - remote UDP port 42061 to remote TCP port 42061