Skip to content

Instantly share code, notes, and snippets.

@mariotpc
Last active January 20, 2021 01:44
Show Gist options
  • Save mariotpc/984a9bbe3937f5b0e01749909a6fb585 to your computer and use it in GitHub Desktop.
Save mariotpc/984a9bbe3937f5b0e01749909a6fb585 to your computer and use it in GitHub Desktop.
Configure SNMP on my Server
First all I found that the package net-snmp must be installed on the system
After install the package, the file snmpd.conf must be edited in order to allow the queries
In my case, just add...
rocommunity secret 186.151.0.0/16 # <- network for example pourposes
configure iptables on the server to let UDP traffic flow on port 161,162
iptables -D IN_public_allow -s 186.151.XXX.XXX -p udp -m udp --dport 161 -j ACCEPT
iptables -D IN_public_allow -s 186.151.XXX.XXX -p udp -m udp --dport 162 -j ACCEPT
Let check on client side
alpine:~# snmpget -v 1 -c secret -Oqv 181.115.XXX.XXX IF-MIB::ifInOctets.2
3018304626
alpine:~# snmpget -v 1 -c secret -Oqv 181.115.XXX.XXX IF-MIB::ifOutOctets.2
767023988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment