配置设备使用SNMPv3 USM用户与网管通信示例
网管在管理设备时使用SNMPv3版本保证互通,在互通的过程中限制该网管可以管理设备上的部分MIB节点。
组网需求
如图17-12所示,在网络中,用户的两个网管和路由器通过公网相连,由于业务的需求,用户规划网管NMS2可以管理路由器上的所有节点,网管站NMS1不再管理该路由器。
NMS2管理路由器的过程中,为了方便对告警信息进行定位,避免过多的无用告警对处理问题造成干扰,用户只允许缺省打开的模块可以发送告警至NMS。
由于NMS2和路由器间的数据需要穿越公网,对用户的数据进行认证和加密。
由于网管管理员离路由器较远,为了使路由器出现故障时网管管理员能快速联系上该设备管理员,以便对故障进行快速定位和排除,故要求在路由器上配置设备管理员的联系方法。
本例中interface1代表GE0/1/0。
配置思路
采用如下思路配置设备使用SNMPv3与网管通信:
使能SNMP Agent。
配置路由器的SNMP版本为SNMPv3。
配置用户访问权限,限制NMS2可以管理路由器上的节点。
配置路由器的Trap功能,使路由器产生的告警能够发送至NMS2。
配置设备管理员联系方式。
配置网管站(NMS2)。
操作步骤
- 配置路由器和网管站之间路由可达(略)
- 使能SNMP Agent。
<HUAWEI> system-view
[~HUAWEI] sysname DeviceA
[*HUAWEI] snmp-agent password min-length 10
[*HUAWEI] snmp-agent
[*HUAWEI] commit
- 配置路由器的SNMP版本为SNMPv3。
[~DeviceA] snmp-agent sys-info version v3
[*DeviceA] commit
# 查看SNMP版本。
[~DeviceA] display snmp-agent sys-info version
SNMP version running in the system:
SNMPv3
- 配置网管站的访问权限。
# 配置ACL,限制NMS2可以管理路由器,NMS1不允许管理路由器。
[~DeviceA] acl 2001
[*DeviceA-acl4-basic-2001] rule 5 permit source 1.1.1.2 0.0.0.0
[*DeviceA-acl4-basic-2001] rule 6 deny source 1.1.1.1 0.0.0.0
[*DeviceA-acl4-basic-2001] commit
[~DeviceA-acl4-basic-2001] quit
# 配置MIB视图。
[~DeviceA] snmp-agent mib-view included iso iso
[*DeviceA] commit
# 配置用户组和用户,对用户的数据进行认证和加密。
[~DeviceA] snmp-agent group v3 admin privacy write-view iso notify-view iso read-view iso [*DeviceA] snmp-agent usm-user v3 nms2-admin group admin acl 2001 [*DeviceA] snmp-agent usm-user v3 nms2-admin authentication-mode sha Please configure the authentication password (10-255) Enter Password: Confirm Password: [*DeviceA] snmp-agent usm-user v3 nms2-admin privacy-mode aes128 Please configure the privacy password (10-255) Enter Password: Confirm Password:
[*DeviceA] commit
- 配置告警功能。
[~DeviceA] snmp-agent target-host trap address udp-domain 1.1.1.2 params securityname nms2-admin v3 privacy [*DeviceA] snmp-agent trap enable
[*DeviceA] commit
- 配置设备管理员联系方式。
[~DeviceA] snmp-agent sys-info contact call Operator at 010-12345678
[*DeviceA] commit
- 配置网管站。
网管的配置请根据采用的网管产品参考对应的网管配置手册。
- 验证配置结果。
配置完成后,可以执行下面的命令,检查配置内容是否生效。
# 查看SNMP版本。
[~DeviceA] display snmp-agent sys-info version
SNMP version running in the system:
SNMPv3
# 查看用户组信息。
<DeviceA> display snmp-agent group admin
Group name: admin Security model: v3 Readview: iso Writeview: iso Notifyview: iso Storage-type: nonVolatile
# 查看用户信息。
<DeviceA> display snmp-agent usm-user
User name: nms2-admin, Engine ID: 800007DB0300259E0370C3 active Authentication Protocol: sha Privacy Protocol: aes128 Group-name: admin State: Active Acl: 2001
# 查看ACL配置。<DeviceA> display acl 2001
Basic ACL 2001, 2 rules ACL's step is 5 rule 5 permit ip source 1.1.1.1 0 (4 times matched) rule 6 deny source 1.1.1.1 0 (0 times matched)
# 查看MIB视图。
<DeviceA> display snmp-agent mib-view viewname iso
View name: iso MIB Subtree: iso Subtree mask: FF80(Hex) Storage-type: nonVolatile View Type: included View status: active
# 查看告警的目标主机。
<DeviceA> display snmp-agent target-host Target-host NO. 1 --------------------------------------------------------------------------- Host-name : - IP-address : 1.1.1.2 Source interface : - VPN instance : - Security name : nms2-admin Port : 162 Type : trap Version : v3 Level : Privacy NMS type : NMS With ext-vb : No Notification filter profile name : - ---------------------------------------------------------------------------
# 配置设备管理员联系方式。
<DeviceA> display snmp-agent sys-info contact The contact person for this managed node: call Operator at 010-12345678
配置文件
路由器的配置文件
# sysname DeviceA # snmp-agent trap type base-trap # acl number 2001 rule 5 permit source 1.1.1.2 0.0.0.0 rule 6 deny source 1.1.1.1 0.0.0.0 # interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.2.1 255.255.255.0 # interface loopback0 ip address 1.1.3.1 255.255.255.255 # ospf 1 area 0.0.0.0 network 1.1.2.0 0.0.0.255 network 1.1.3.1 0.0.0.0 # snmp-agent snmp-agent password min-length 10 snmp-agent local-engineid 800007DB03360102101100 # snmp-agent sys-info contact call Operator at 010-12345678 snmp-agent sys-info version v3 snmp-agent group v3 admin privacy write-view iso notify-view iso read-view iso snmp-agent target-host trap address udp-domain 1.1.1.2 params securityname nms2-admin v3 privacy # snmp-agent mib-view included iso iso snmp-agent usm-user v3 nms2-admin group admin acl 2001 snmp-agent usm-user v3 nms2-admin authentication-mode sha %#%##/L&Fd]S.!i*S7<\jCh2DkfkE4+:<%Wap|8zZWwPL+[a>h$wy>VJsp9(L{%B%#%# snmp-agent usm-user v3 nms2-admin privacy-mode aes128 %#%#CM-]HDuhH6VX)**J<186nf({M823f(0Z73++7(A#%,1jODj}D>_HS>W,'Ss=%#%# # return