RHEL9.2 snmpd.conf コミュニティ名とセキュリティの紐付けサンプル

環境
Red Hat Enterprise Linux release 9.2 (Plow)
snmpd 5.9.1

概要
com2secは、 communityとsource ip addressの紐づけで、
紐付けにはsecurity nameという名前を定義します。

操作方法
1.groupの定義
cfnetに対してsnmp version 1, snmp version 2cを許可します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/snmp/snmpd.conf
# sec.model sec.name
group mygroup v1 cfnet
group mygroup v2c cfnet
# vi /etc/snmp/snmpd.conf # sec.model sec.name group mygroup v1 cfnet group mygroup v2c cfnet
# vi /etc/snmp/snmpd.conf
 
#             sec.model  sec.name
group mygroup v1         cfnet
group mygroup v2c        cfnet

2.取得可能なOIDの範囲の定義view
viewは、取得可能なOIDの範囲です。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/snmp/snmpd.conf
# incl/excl subtree mask
view all included .1 80
view system included system fe
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
# vi /etc/snmp/snmpd.conf # incl/excl subtree mask view all included .1 80 view system included system fe view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
# vi /etc/snmp/snmpd.conf
 
#           incl/excl subtree                          mask
view all    included  .1                               80
view system included  system                           fe
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

3.権限設定access定義
accessは、 各security nameに対しての権限設定です。
設定可能な権限は、読取, 書込, 通知 (read, write, notify) の3種類です。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi /etc/snmp/snmpd.conf
# context sec.model sec.level prefix read write notify
access mygroup "" any noauth exact mib2 none none
access public "" any noauth exact system none none
access local "" any noauth exact all all all
# vi /etc/snmp/snmpd.conf # context sec.model sec.level prefix read write notify access mygroup "" any noauth exact mib2 none none access public "" any noauth exact system none none access local "" any noauth exact all all all
# vi /etc/snmp/snmpd.conf
 
#              context sec.model sec.level prefix read   write notify
access mygroup ""      any       noauth    exact  mib2   none  none
access public  ""      any       noauth    exact  system none  none
access local   ""      any       noauth    exact  all    all   all

 

IT

Posted by arkgame