1.download net-snmp source package from sourceforge.net.use the version 5.0.11.

2.install according to INSTALL.
    ./configure
    make
    make install
    make clean.

3.copy EXAMPLE.conf file to ~/.snmp/ as snmpd.conf,and change some configurations if needed.

4.add snmpv3 Config
snmpv3 config command:
net-snmp-config --create-snmpv3-user -ro -a authpass -x privpass -X DES -A MD5 v3username
after run ,it will modify to files.
adding the following line to /var/net-snmp/snmpd.conf:
    createUser v3user MD5 "authpass" DES privpass
adding the following line to /usr/local/share/snmp/snmpd.conf:
    rouser v3username

actually,the snmpd program uses the config file under ~/.snmp/.So add the user name
in file ~/.snmp/snmpd.conf.
at last,the Access Control section maybe like this.
---------------------------------------------------------------------------------------------
# rouser: a SNMPv3 read-only user
#   arguments:  user [noauth|auth|priv] [restriction_oid]
rouser v3username

#
# Unknown directives read in from other files by snmpconf
#
com2sec local     localhost       public
com2sec mynetwork 192.168.7.0/24      public
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork
view all    included  .1                               80
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none
access MyRWGroup cname   any       auth      exact  all    all    none
---------------------------------------------------------------------------------------------


5.Run test
snmpv3  walk command for net-snmp agnet.

snmpwalk -v 3 -u v3username -l authPriv -a MD5 -A authpass -x DES -X privpass localhost system





[root@localhost .snmp]# snmpd -v

NET-SNMP version:  5.0.11
Web:               http://www.net-snmp.org/
Email:             net-snmp-coders@lists.sourceforge.net
Logo

更多推荐