apt-get install snmpd
This will install the snmpd binary and the boot-time startup
script and links. Then edit
/etc/snmp/snmpd.conf and set something like:
com2sec readonly default public
#access MyRWGroup "" any noauth exact all all none
syslocation NCAR computer room, 1850 Table Mesa Drive, Boulder, CO, USA
syscontact David Mitchell, mitchell@ucar.edu, 303-497-1845
chkconfig snmpd on
Note that before you can talk to the daemon from another machine,
you have to change your iptables to allow SNMP.
cd /usr/sbin
mv snmpd snmpd.orig
ln -s ../local/sbin/snmpd snmpd
To configure snmpd, edit the /etc/snmpd.conf
file. For an explanation of this, do man
snmpd.conf.
Step 1: use "com2sec" lines to define a "security names", which are names for a sets of things that are to be treated the same in terms of access rights. For instance, I'll define a security named "ucarsec" to cover inbound SNMP requests that come from from a 128.117.0.0 source and that contain the community string "public".
Step 2: use "group" lines to define different actions based on the type of request. You'd use this if you wanted to make different access for SNMP v1 requests than for SNMP v2 requests. I don't, so I just map the security names to group names without doing anything fancy.
Step 3: use "view" lines to define define sections of the MIB tree that you want to protect differently than other sections. I'll define one global view named "all" and one named "system" that covers just the system table.
Step 4: use "access" lines to map groups to views. I'll allow the "local" group to have access to the "all" view (the whole MIB), and I'll allow the "ucar" group to have access to the "system" view (only the "system" part of the MIB).
syslocation ML31G, NCAR, 1850 Table Mesa Drive, Boulder, CO 80305
syscontact Pete Siemsen, siemsen@ucar.edu
com2sec localsec localhost public
com2sec ucarsec 128.117.0.0/16 public
group local v1 localsec
group local v2c localsec
group ucar v1 ucarsec
group ucar v2c ucarsec
view all included .1
view system included system fe
access local "" any noauth exact all none none
access ucar "" any noauth exact system none none
Then, to start the daemon and make it start at boot time,
/etc/rc.d/init.d/snmpd start
chkconfig --add snmpd
chkconfig snmpd on
To make the system permit inbound SNMP packets, edit the
/etc/sysconfig/ipchains file and add these lines:
# 161=snmp
-A input -s 0/0 -d 0/0 161 -p udp -j ACCEPT
# 162=snmp traps
-A input -s 0/0 -d 0/0 162 -p udp -j ACCEPT