配置设备使用SNMPv3与网管通信示例
组网需求
如图1-11所示,现有网络中网管NMS1和NMS2对网络中的设备进行监管。由于网络规模较大,安全性较低,在规划时配置设备使用SNMPv3版本与网管进行通信,并配置认证加密功能保证安全性。现在由于扩容需要,新增一台交换机,并由网管NMS2对其进行监管。
用户希望通过利用现有的网络资源对交换机进行监管,并且对发生故障能够快速对故障定位和排除。
配置思路
考虑到用户所在网络规模较大,安全性较低,因此新增设备依然使用SNMPv3版本。为减轻网管站的负担,选取NMS2来监管交换机,NMS1不监管交换机。
采用如下的配置思路:
配置交换机的SNMP版本为SNMPv3。
配置访问权限,使NMS2可以管理ISO节点。
配置告警主机,使交换机产生的告警能够发送至NMS2。为了方便对告警信息进行定位,避免过多的无用告警对处理问题造成干扰,仅允许缺省打开的模块可以发送告警。
配置交换机管理员的联系方法,以便交换机出现故障时网管管理员能快速联系上就近的设备管理员,以便对故障进行快速定位和排除。
配置网管NMS2。
操作步骤
- 配置交换机的接口IP地址
# 按图1-11所示,配置交换机的接口IP地址。
<Quidway> system-view [Quidway] sysname Switch [Switch] vlan 100 [Switch-vlan100] quit [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port hybrid pvid vlan 100 [Switch-GigabitEthernet1/0/1] port hybrid untagged vlan 100 [Switch-GigabitEthernet1/0/1] quit [Switch] interface vlanif 100 [Switch-Vlanif100] ip address 10.1.2.1 24 [Switch-Vlanif100] quit
- 配置交换机和网管站之间路由可达
[Switch] ospf [Switch-ospf-1] area 0 [Switch-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [Switch-ospf-1-area-0.0.0.0] quit [Switch-ospf-1] quit
- 配置交换机的SNMP版本为SNMPv3
[Switch] snmp-agent sys-info version v3
- 配置访问权限
# 配置ACL,使NMS2可以管理交换机,NMS1不允许管理交换机。
[Switch] acl 2001 [Switch-acl-basic-2001] rule 5 permit source 10.1.1.2 0.0.0.0 [Switch-acl-basic-2001] rule 6 deny source 10.1.1.1 0.0.0.0 [Switch-acl-basic-2001] quit
# 配置MIB视图。
[Switch] snmp-agent mib-view included isoview iso
# 配置用户组。
[Switch] snmp-agent group v3 admin privacy read-view isoview write-view isoview notify-view isoview acl 2001
# 配置用户。
[Switch] snmp-agent usm-user v3 nms2-admin group admin
# 对用户报文进行认证,认证密码为Authe@1234。
[Switch] snmp-agent usm-user v3 nms2-admin authentication-mode sha2-256 Please configure the authentication password (8-64) Enter Password: //输入认证密码,本例的认证密码为:Authe@1234。 Confirm Password: //输入认证密码,本例的认证密码为:Authe@1234。
# 对用户报文进行加密,加密密码为Priva@1234。
[Switch] snmp-agent usm-user v3 nms2-admin privacy-mode aes128 Please configure the privacy password (8-64) Enter Password: //输入加密密码,本例的加密密码为:Priva@1234。 Confirm Password: //输入加密密码,本例的加密密码为:Priva@1234。
- 配置告警主机
[Switch] snmp-agent target-host trap address udp-domain 10.1.1.2 params securityname nms2-admin v3 privacy
- 配置设备管理员联系方式
[Switch] snmp-agent sys-info contact call Operator at 010-12345678
- 配置网管站
在使用SNMPv3版本的NMS上需要设置用户名,选择安全级别。根据不同的安全级别,需要分别设置认证方式、认证密码、加密方式、加密密码等。网管的配置请根据采用的网管产品参考对应的网管配置手册。
网管系统的认证参数配置必须和设备上保持一致,否则网管系统无法管理设备。
- 验证配置结果
配置完成后,可以执行下面的命令,检查配置内容是否生效。
# 查看SNMP版本。
[Switch] display snmp-agent sys-info version SNMP version running in the system: Polling: SNMPv1:disable, SNMPv2c:disable, SNMPv3:enable Trap : SNMPv1:disable, SNMPv2c:disable, SNMPv3:enable
# 查看用户组信息。
[Switch] display snmp-agent group admin Group name: admin Security model: v3 AuthPriv Readview: ViewDefault Writeview: isoview Notifyview :<no specified> Storage-type: nonVolatile Acl:2001
# 查看MIB视图。
[Switch] display snmp-agent mib-view viewname isoview View name:isoview MIB Subtree:iso Subtree mask:FC(Hex) Storage-type: nonVolatile View Type:included View status:active
# 查看告警的目标主机。
[Switch] display snmp-agent target-host Target-host NO. 1 ----------------------------------------------------------- IP-address : 10.1.1.2 Domain : - Source interface : - VPN instance : - Security name : nms2-admin Port : 162 Type : trap Version : v3 Level : Privacy NMS type : NMS With ext-vb : No -----------------------------------------------------------
# 配置设备管理员联系方式。
[Switch] display snmp-agent sys-info contact The contact person for this managed node: call Operator at 010-12345678
配置文件
Switch的配置文件
# sysname Switch # vlan batch 100 # acl number 2001 rule 5 permit source 10.1.1.2 0 rule 6 deny source 10.1.1.1 0 # interface Vlanif100 ip address 10.1.2.1 255.255.255.0 # interface GigabitEthernet1/0/1 port hybrid pvid vlan 100 port hybrid untagged vlan 100 # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.255 # snmp-agent snmp-agent local-engineid 800007DB0300259E0370C3 snmp-agent sys-info contact call Operator at 010-12345678 snmp-agent sys-info version v3 snmp-agent group v3 admin privacy read-view isoview write-view isoview notify-view isoview acl 2001 snmp-agent target-host trap address udp-domain 10.1.1.2 params securityname nms2-admin v3 privacy snmp-agent mib-view included isoview iso snmp-agent usm-user v3 nms2-admin snmp-agent usm-user v3 nms2-admin group admin snmp-agent usm-user v3 nms2-admin authentication-mode sha2-256 cipher %^%#odaJ7R)/O7k$pwQx0qfD0\`u*'GI1(|;ZQXHtzrN%^%# snmp-agent usm-user v3 nms2-admin privacy-mode aes128 cipher %^%#f*K3/|E6d"SJes9)5naXPIqCTpR"}BUC=yW;!(f9%^%# # return