Net-SNMP Tutorial -- SNMPv3 訪問方式

Here is a completely unauthenticated request (which still needs a user name, none the less):

% snmpgetnext -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTimesystem.sysUpTime.0 = Timeticks: (83467131) 9 days, 15:51:11.31

Here is a authenticated request:

% snmpgetnext -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTimesystem.sysUpTime.0 = Timeticks: (83491735) 9 days, 15:55:17.35

And finally, here is an authenticated and encrypted request:

% snmpgetnext -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org systemsystem.sysUpTime.0 = Timeticks: (83493111) 9 days, 15:55:31.11

Of course, they don't look much different since they all worked identically. But, the host above allows us to look at it using any level of authentication. Any hosts you set up should be more restricted than that and require at least a level of authNoPriv when you configure the VACM access control.

Finally, consider a snmp.conf file that looks like this:

defContext none
defSecurityName MD5User
defAuthPassphrase The Net-SNMP Demo Password
defVersion 3
defAuthType MD5
defSecurityLevel authNoPriv

This sets up the defaults for you so that your snmp commands can boil down to something as simple as:

% snmpgetnext test.net-snmp.org sysUpTimesystem.sysUpTime.3.0 = Timeticks: (83517052) 9 days, 15:59:30.52

Or:

% snmpset test.net-snmp.org ucdDemoPublicString.0 s "I changed  something"enterprises.ucdavis.ucdDemoMIB.ucdDemoMIBObjects.ucdDemoPublic.ucdDemoPublicString.2.0 = "I changed something"

Then:

% snmpget test.net-snmp.org ucdDemoPublicString.0enterprises.ucdavis.ucdDemoMIB.ucdDemoMIBObjects.ucdDemoPublic.ucdDemoPublicString.2.0 = "I changed something"


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章