SNMP Support for Multiple Instance of OSPF Configuration
Overview
SNMP operation by default are tied to a specific OID which is unique. However protocol like OSPF can have multiple instances, and have different values of same parameters for different OSPF instances. To be able to support SNMP for each of these instances, it is needed that each instance of the protocol has its own instance of the MIBs. It is aimed to achieve that with mapping each instance to a context. Each context will point to a different copy of the same OID for the protocol.
Topology
Figure 8-79: SNMP OSPF instance
Enable SNMP and create SNMP Context & Group for OSPF Instances on a Router with SNMPv2
In this example, routers R1 & R2 are in Area 0, and all run OSPF. SNMPv2 user is created and Mapping of user with group and context for SNMPwalk /SNMP get operation on context.
R1
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group1 version 2c context context1 vrf management | Creates SNMP group with Group name and for specific context in SNMP v2 version. |
(config)#snmp-server user user1 group1 vrf management | Creates SNMP User in SNMPv2 and attach user into a group |
(config)#snmp-server community cm1 vrf management | Set community string as "cm1" |
(config)#snmp-server community-map cm1 context context1 user user1 vrf management | Creates Community map SNMPv2 with community name mapping user with a context. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.3/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 21.21.21.21 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
R2
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group1 version 2c context context1 vrf management | Creates SNMP group with Group name and for specific context in SNMP v2 version. |
(config)#snmp-server user user1 group1 vrf management | Creates SNMP User in SNMPv2 and attach user into a group |
(config)#snmp-server community cm1 vrf management | Set community string as "cm1" |
(config)#snmp-server community-map cm1 context context1 user user1 vrf management | Creates Community map SNMPv2 with community name mapping user with a context. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.2/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 23.23.23.23 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
Validation
R1
R1#sh running-config
!
! Software version: EC_AS7326-56X-OcNOS-5.1.194-DC-MPLS-S0-P0 04/20/2022 18:27:17
!
!Last configuration change at 12:56:57 UTC Fri Apr 22 2022 by ocnos
!
no service password-encryption
!
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
ip vrf management
!
hostname R1
!
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server group group1 version 2c context context1 vrf management
snmp-server user user1 group1 vrf management
snmp-server community cm1 vrf management
snmp-server community-map cm1 context context1 user user1 vrf management
!
interface ce1
!
interface ce2
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 21.21.21.21/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.3/24
!
interface xe2
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
router ospf 100
ospf router-id 21.21.21.21
snmp context-name context1
network 21.21.21.21/32 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
!
end
R1#
R1#show ip ospf neighbor
Total number of full neighbors: 1
OSPF process 100 VRF(default):
Neighbor ID Pri State Dead Time Address Interface
Instance ID
23.23.23.23 1 Full/ - 00:00:37 94.94.94.2 xe1
R1#sh snmp context
---------------------------------------------------------------------
context groups
---------------------------------------------------------------------
context1 group1
R1#
R2
R2#sh running-config
!
! Software version: EC_AS5912-54X-OcNOS-5.1.194-SP-MPLS-S0-P0 04/20/2022 18:28:57
!
!Last configuration change at 13:01:05 UTC Fri Apr 22 2022 by root
!
no service password-encryption
!
logging console 5
logging level all 5
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
hostname R2
bridge 1 protocol ieee vlan-bridge
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server group group1 version 2c context context1 vrf management
snmp-server user user1 group1 vrf management
snmp-server community cm1 vrf management
snmp-server community-map cm1 context context1 user user1 vrf management
feature ntp vrf management
ntp enable vrf management
!
interface ce49
!
interface ce50
!
interface ce51
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 23.23.23.23/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.2/24
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 100
ospf router-id 23.23.23.23
snmp context-name context1
network 23.23.23.23/32 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
!
end
R2#
R2#sh snmp context
---------------------------------------------------------------------
context groups
---------------------------------------------------------------------
context1 group1
R2#
SNMP WALK Command
Perform snmpwalk as mentioned below with IPv4 address using SNMPv2
snmpwalk -v2c -c cm1 10.12.86.116 .1.3
[root@localhost ~]# snmpwalk -v2c -c cm1 10.12.86.116 .1.3
OSPF-MIB::ospfRouterId.0 = IpAddress: 23.23.23.23
OSPF-MIB::ospfAdminStat.0 = INTEGER: enabled(1)
OSPF-MIB::ospfVersionNumber.0 = INTEGER: version2(2)
OSPF-MIB::ospfExternLsaCount.0 = Gauge32: 0
OSPF-MIB::ospfExternLsaCksumSum.0 = INTEGER: 0
OSPF-MIB::ospfTOSSupport.0 = INTEGER: false(2)
OSPF-MIB::ospfOriginateNewLsas.0 = Counter32: 3
OSPF-MIB::ospfRxNewLsas.0 = Counter32: 14
OSPF-MIB::ospfExtLsdbLimit.0 = INTEGER: -1
OSPF-MIB::ospfMulticastExtensions.0 = INTEGER: 0
OSPF-MIB::ospfExitOverflowInterval.0 = INTEGER: 0
OSPF-MIB::ospfDemandExtensions.0 = INTEGER: false(2)
OSPF-MIB::ospfRFC1583Compatibility.0 = INTEGER: false(2)
OSPF-MIB::ospfOpaqueLsaSupport.0 = INTEGER: true(1)
OSPF-MIB::ospfReferenceBandwidth.0 = Gauge32: 100000 kilobits per second
OSPF-MIB::ospfRestartSupport.0 = INTEGER: plannedAndUnplanned(3)
OSPF-MIB::ospfRestartInterval.0 = INTEGER: 120 seconds
OSPF-MIB::ospfRestartStrictLsaChecking.0 = INTEGER: true(1)
OSPF-MIB::ospfRestartStatus.0 = INTEGER: notRestarting(1)
OSPF-MIB::ospfRestartAge.0 = Gauge32: 0 seconds
OSPF-MIB::ospfRestartExitReason.0 = INTEGER: none(1)
OSPF-MIB::ospfAsLsaCount.0 = Gauge32: 0
OSPF-MIB::ospfAsLsaCksumSum.0 = Gauge32: 0
OSPF-MIB::ospfStubRouterSupport.0 = INTEGER: false(2)
OSPF-MIB::ospfStubRouterAdvertisement.0 = INTEGER: doNotAdvertise(1)
OSPF-MIB::ospfDiscontinuityTime.0 = Timeticks: (0) 0:00:00.00
OSPF-MIB::ospfAreaId.0.0.0.0 = IpAddress: 0.0.0.0
OSPF-MIB::ospfAuthType.0.0.0.0 = INTEGER: none(0)
OSPF-MIB::ospfImportAsExtern.0.0.0.0 = INTEGER: importExternal(1)
OSPF-MIB::ospfSpfRuns.0.0.0.0 = Counter32: 5
OSPF-MIB::ospfAreaBdrRtrCount.0.0.0.0 = Gauge32: 0
OSPF-MIB::ospfAsBdrRtrCount.0.0.0.0 = Gauge32: 0
OSPF-MIB::ospfAreaLsaCount.0.0.0.0 = Gauge32: 6
OSPF-MIB::ospfAreaLsaCksumSum.0.0.0.0 = INTEGER: 199510
OSPF-MIB::ospfAreaSummary.0.0.0.0 = INTEGER: sendAreaSummary(2)
OSPF-MIB::ospfAreaStatus.0.0.0.0 = INTEGER: active(1)
OSPF-MIB::ospfAreaNssaTranslatorRole.0.0.0.0 = INTEGER: 0
OSPF-MIB::ospfAreaNssaTranslatorState.0.0.0.0 = INTEGER: 0
OSPF-MIB::ospfAreaNssaTranslatorStabilityInterval.0.0.0.0 = INTEGER: 40 seconds
OSPF-MIB::ospfAreaLsaCountNumber.0.0.0.0 = Gauge32: 6
OSPF-MIB::ospfAreaLsaCountNumber.0.0.0.0 = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@localhost ~]#
Perform snmpwalk as mentioned below with IPv4 address using SNMPv2 for R2
snmpwalk -v2c -c cm1 10.12.86.111 .1.3
Enable SNMP and create SNMP Context & Group for OSPF Instances on a Router with SNMPv3 Configuration
In this example, routers R1 & R2 are in Area 0, and all run OSPF. SNMPv3 user is created and Mapping of user with group and context for SNMPwalk /SNMP get operation on context.
R1
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group2 version 3 auth context context1 vrf management | Creates SNMP group with Group name and for specific context in SNMP v3 version. |
(config)#snmp-server user user2 group2 auth md5 password vrf management | Creates SNMP User in SNMPv3 and attach user into a group |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.3/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 21.21.21.21 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
R2
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group2 version 3 auth context context1 vrf management | Creates SNMP group with Group name and for specific context in SNMP v3 version. |
(config)#snmp-server user user2 group2 auth md5 password vrf management | Creates SNMP User in SNMPv2 and attach user into a group |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.2/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 23.23.23.23 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
Validation
R1
R1#sh running-config
!
! Software version: EC_AS7326-56X-OcNOS-5.1.194-DC-MPLS-S0-P0 04/20/2022 18:27:1
7
!
!Last configuration change at 14:06:07 UTC Fri Apr 22 2022 by root
!
no service password-encryption
!
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
ip vrf management
!
hostname R1
ip name-server vrf management 10.12.3.23
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server group grp2 version 3 auth context context2 vrf management
snmp-server user user2 grp2 auth md5 encrypt 0x2eaaa9043312c907 vrf management
feature ntp vrf management
ntp enable vrf management
feature rsyslog vrf management
!
interface ce49
!
interface ce50
!
interface ce51
!
interface ce52
!
interface ce53
!
interface ce54
!
interface ce55
!
interface ce56
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 21.21.21.21/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.3/24
!
interface xe2
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 100
ospf router-id 21.21.21.21
snmp context-name context1
network 21.21.21.21/32 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
!
line console 0
exec-timeout 0 0
line vty 0 871
exec-timeout 0 0
privilege level 16
!
!
end
R1#
R2
R2# sh run
!
! Software version: EC_AS5912-54X-OcNOS-5.1.194-SP-MPLS-S0-P0 04/20/2022 18:28:5
7
!
!Last configuration change at 14:28:48 UTC Fri Apr 22 2022 by root
!
no service password-encryption
!
logging console 5
logging level all 5
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
hostname R2
no ip domain-lookup
ip domain-lookup vrf management
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server group group2 version 3 auth context context1 vrf management
snmp-server user user2 group2 auth md5 encrypt 0x2eaaa9043312c907 vrf management
feature ntp vrf management
ntp enable vrf management
feature rsyslog vrf management
!
interface ce49
!
interface ce50
!
interface ce51
!
interface ce52
!
interface ce53
!
interface ce54
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 23.23.23.23/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.2/24
!
interface xe2
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 100
ospf router-id 23.23.23.23
bfd all-interfaces
network 23.23.23.23/32 area 0.0.0.0
network 91.91.91.0/24 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
network 96.96.96.0/24 area 0.0.0.0
!
!
end
R2#
SNMP WALK Command
Perform snmpwalk as mentioned below with IPv4 address using SNMPv3 of R2
snmpwalk -v 3 -u user2 -l auth -r 0 -t 10 -n "context1" -a MD5 -A password 10.12.86.116 iso.3.6.1.2.1
[root@localhost ~]# snmpwalk -v 3 -u user2 -l auth -r 0 -t 10 -n "context1" -a MD5 -A password 10.12.86.116 iso.3.6.1.2.1
OSPF-MIB::ospfRouterId.0 = IpAddress: 23.23.23.23
OSPF-MIB::ospfAdminStat.0 = INTEGER: enabled(1)
OSPF-MIB::ospfVersionNumber.0 = INTEGER: version2(2)
OSPF-MIB::ospfExternLsaCount.0 = Gauge32: 0
OSPF-MIB::ospfExternLsaCksumSum.0 = INTEGER: 0
OSPF-MIB::ospfTOSSupport.0 = INTEGER: false(2)
OSPF-MIB::ospfOriginateNewLsas.0 = Counter32: 3
OSPF-MIB::ospfRxNewLsas.0 = Counter32: 7
OSPF-MIB::ospfExtLsdbLimit.0 = INTEGER: -1
OSPF-MIB::ospfMulticastExtensions.0 = INTEGER: 0
OSPF-MIB::ospfExitOverflowInterval.0 = INTEGER: 0
OSPF-MIB::ospfDemandExtensions.0 = INTEGER: false(2)
OSPF-MIB::ospfRFC1583Compatibility.0 = INTEGER: false(2)
OSPF-MIB::ospfOpaqueLsaSupport.0 = INTEGER: true(1)
OSPF-MIB::ospfReferenceBandwidth.0 = Gauge32: 100000 kilobits per second
OSPF-MIB::ospfRestartSupport.0 = INTEGER: plannedAndUnplanned(3)
OSPF-MIB::ospfRestartInterval.0 = INTEGER: 120 seconds
OSPF-MIB::ospfRestartStrictLsaChecking.0 = INTEGER: true(1)
OSPF-MIB::ospfRestartStatus.0 = INTEGER: notRestarting(1)
OSPF-MIB::ospfRestartAge.0 = Gauge32: 0 seconds
OSPF-MIB::ospfRestartExitReason.0 = INTEGER: none(1)
OSPF-MIB::ospfAsLsaCount.0 = Gauge32: 0
OSPF-MIB::ospfAsLsaCksumSum.0 = Gauge32: 0
OSPF-MIB::ospfStubRouterSupport.0 = INTEGER: false(2)
OSPF-MIB::ospfStubRouterAdvertisement.0 = INTEGER: doNotAdvertise(1)
OSPF-MIB::ospfDiscontinuityTime.0 = Timeticks: (0) 0:00:00.00
OSPF-MIB::ospfAreaId.0.0.0.0 = IpAddress: 0.0.0.0
OSPF-MIB::ospfAuthType.0.0.0.0 = INTEGER: none(0)
OSPF-MIB::ospfAreaLsaCountNumber.0.0.0.0 = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@localhost ~]#
Perform snmpwalk as mentioned below with IPv4 address using SNMPv3 for R1.
snmpwalk -v 3 -u user2 -l auth -r 0 -t 10 -n "context1" -a MD5 -A password 10.12.86.111 iso.3.6.1.2.1
Enable SNMP and create SNMP Context & Group for Multiple OSPF Instances on a Router with SNMPv2/v3
In this example, routers R1, R2 & R3 are in Area 0, and all run OSPF. SNMPv2/v3 user is created and Mapping of user with group and context for SNMPwalk /SNMP get operation on context.
Topology
Figure 8-80: SNMP OSPF multiple instance
Configurations
R1
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group1 version 2c context context1 vrf management | Creates SNMP group with Group name and for specific context in SNMP v2 version. |
(config)#snmp-server group group2 version 3 auth context context1 vrf ma | Creates SNMP group with Group name and for specific context in SNMP v3 version |
(config)#snmp-server user user1 group1 vrf management | Creates SNMP User in SNMPv2 and attach user into a group |
(config)#snmp-server user user2 group2 auth md5 password vrf management | Creates SNMP User in SNMPv3 and attach user into a group |
(config)#snmp-server community cm1 vrf management | Set community string as "cm1" |
(config)#snmp-server community-map cm1 context context1 user user1 vrf management | Creates Community map SNMPv2 with community name mapping user with a context. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.3/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 21.21.21.21 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
R2
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context1 vrf management | Creates SNMP Context with Context name "context1". |
(config)#snmp-server context context2 vrf management | Creates SNMP Context with Context name"context2". |
(config)#snmp-server group group1 version 3 auth context context1 vrf management | Creates SNMP group with Group name and for context 1 in SNMP v3 version. |
(config)#snmp-server group group1 version 3 auth context context2 vrf management | Creates SNMP group with Group name and for context 2 in SNMP v3 version. |
(config)#snmp-server user user1 group1 auth md5 password vrf management | Creates SNMP User in SNMPv3 and attach user into a group |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe1 | Enter interface mode for xe1. |
(config-if)#ip address 94.94.94.2/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#interface xe2 | Enter interface mode for xe2. |
(config-if)#ip address 10.1.2.2/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 100 | Configure an OSPF instance with an instance ID of 100. |
(config-router)#router-id 23.23.23.23 | Configure the router ID to use on this instance. |
(config-router)#network 94.94.94.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context1 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
(config)#router ospf 200 | Configure an OSPF instance with an instance ID of 200. |
(config-router)#router-id 24.24.24.24 | Configure the router ID to use on this instance. |
(config-router)#network 10.1.2.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context2 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
R3
#configure terminal | Enter configure mode. |
(config)#snmp-server enable snmp vrf management | Use this command to start the SNMP agent. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
#configure terminal | Enter configure mode. |
(config)#snmp-server context context2 vrf management | Creates SNMP Context with Context name. |
(config)#snmp-server group group1 version 2c context context2 vrf management | Creates SNMP group with Group name and for specific context in SNMP v2 version. |
(config)#snmp-server group group2 version 3 auth context context2 vrf management | Creates SNMP group with Group name and for specific context in SNMP v3 version |
(config)#snmp-server user user1 group1 vrf management | Creates SNMP User in SNMPv2 and attach user into a group |
(config)#snmp-server user user2 group2 auth md5 password vrf management | Creates SNMP User in SNMPv3 and attach user into a group |
(config)#snmp-server community cm1 vrf management | Set community string as "cm1" |
(config)#snmp-server community-map cm1 context context1 user user1 vrf management | Creates Community map SNMPv2 with community name mapping user with a context. |
(config)#commit | Commit the candidate configuration to the running configuration |
(config)#exit | Exit configure mode. |
(config)#interface xe2 | Enter interface mode for xe2. |
(config-if)#ip address 10.1.2.3/24 | Specify the IP address of the interface. |
(config-if)#no shutdown | Activate the interface. |
(config-if)#exit | Exit interface mode. |
(config)#router ospf 200 | Configure an OSPF instance with an instance ID of 200. |
(config-router)#router-id 24.24.24.24 | Configure the router ID to use on this instance. |
(config-router)#network 10.1.2.0/24 area 0 | Advertise the network with the area ID. |
(config-router)#snmp context-name context2 | SNMP Context is mapped with OSPF Instance |
(config-router)#commit | Commit the candidate configuration to the running configuration. |
Validation
R1
R1#show run
!
! Software version: EC_AS7326-56X-OcNOS-5.1.194-DC-MPLS-S0-P0 04/20/2022 18:27:1
7
!
!Last configuration change at 15:10:23 UTC Fri Apr 22 2022 by root
!
no service password-encryption
!
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
ip vrf management
!
hostname R1
no ip domain-lookup
ip domain-lookup vrf management
ip name-server vrf management 10.12.3.23
tfo Disable
errdisable cause stp-bpdu-guard
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server group grp1 version 2c context context1 vrf management
snmp-server group grp2 version 3 auth context context1 vrf management
snmp-server user user1 grp1 vrf management
snmp-server user user2 grp2 auth md5 encrypt 0x2eaaa9043312c907 vrf management
snmp-server community cx1 vrf management
snmp-server community-map cx1 context context1 user user1 vrf management
feature ntp vrf management
ntp enable vrf management
feature rsyslog vrf management
!
interface ce49
!
interface ce50
!
interface ce51
!
interface ce52
!
interface ce53
!
interface ce54
!
interface ce55
!
interface ce56
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 21.21.21.21/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.3/24
!
interface xe2
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 100
ospf router-id 21.21.21.21
snmp context-name context1
network 21.21.21.21/32 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
!
line console 0
exec-timeout 0 0
line vty 0 871
exec-timeout 0 0
privilege level 16
!
!
end
R1#
R2
R2(config)#show run
!
! Software version: EC_AS5912-54X-OcNOS-5.1.194-SP-MPLS-S0-P0 04/20/2022 18:28:5
7
!
!Last configuration change at 15:19:14 UTC Fri Apr 22 2022 by ocnos
!
no service password-encryption
!
logging console 5
logging level all 5
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
p vrf management
!
hostname R2
no ip domain-lookup
ip domain-lookup vrf management
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context1 vrf management
snmp-server context context2 vrf management
snmp-server group group1 version 3 auth context context1 vrf management
snmp-server group group1 version 3 auth context context2 vrf management
snmp-server user user1 group1 auth md5 encrypt 0x2eaaa9043312c907 vrf management
feature ntp vrf management
ntp enable vrf management
feature rsyslog vrf management
!
interface ce49
!
interface ce50
!
interface ce51
!
interface ce52
!
interface ce53
!
interface ce54
!
interface eth0
ip vrf forwarding management
ip address dhcp
!
interface lo
ip address 127.0.0.1/8
ip address 23.23.23.23/32 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe1
ip address 94.94.94.2/24
!
interface xe2
ip address 10.1.2.2/24
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 100
ospf router-id 23.23.23.23
snmp context-name context1
network 23.23.23.23/32 area 0.0.0.0
network 94.94.94.0/24 area 0.0.0.0
!
router ospf 200
snmp context-name context2
network 10.1.2.0/24 area 0.0.0.0
!
end
R2#
R3
R3#show run
!
! Software version: EC_AS7316-26XB-OcNOS-5.1.194-SP-CSR-S0-P0 04/20/2022 18:28:5
9
!
!Last configuration change at 11:05:18 UTC Mon Feb 25 2019 by ocnos
!
no service password-encryption
!
snmp-server enable traps link linkDown
snmp-server enable traps link linkUp
!
ip vrf management
!
hostname R3
no ip domain-lookup
ip domain-lookup vrf management
tfo Disable
errdisable cause stp-bpdu-guard
feature telnet vrf management
no feature telnet
feature ssh vrf management
no feature ssh
snmp-server enable snmp vrf management
snmp-server view all .1 included vrf management
snmp-server context context2 vrf management
snmp-server group group2 version 3 auth context context2 vrf management
snmp-server group group1 version 2c context context2 vrf management
snmp-server user user2 group2 auth md5 encrypt 0x2eaaa9043312c907 vrf management
snmp-server user user1 group1 vrf management
snmp-server community cx1 vrf management
snmp-server community-map cx1 context context2 user user1 vrf management
feature ntp vrf management
ntp enable vrf management
feature rsyslog vrf management
!
interface ce0
!
interface ce1
!
interface eth0
ip vrf forwarding management
ip address 192.168.3.10/24
!
interface lo
ip address 127.0.0.1/8
ip address 24.24.24.24/24 secondary
ipv6 address ::1/128
!
interface lo.management
ip vrf forwarding management
ip address 127.0.0.1/8
ipv6 address ::1/128
!
interface xe0
!
interface xe1
!
interface xe2
ip address 10.1.2.3/24
!
interface xe3
!
interface xe4
!
interface xe5
!
interface xe6
!
interface xe7
!
interface xe8
!
interface xe9
!
interface xe10
!
router ospf 200
ospf router-id 24.24.24.24
snmp context-name context2
network 10.1.2.0/24 area 0.0.0.0
network 24.24.24.0/24 area 0.0.0.0
!
!
end
R3#
SNMP WALK Command
Perform snmpwalk as mentioned below with IPv4 address using SNMPv3 for R1:
snmpwalk -v 3 -u user2 -l auth -r 0 -t 10 -n "context1" -a MD5 -A password 10.12.86.111 iso.3.6.1.2.1
Perform snmpwalk as mentioned below with IPv4 address using SNMPv2/SNMPv3 for R2:
snmpwalk -v 3 -u user1 -l auth -r 0 -t 10 -n "context2" -a MD5 -A password 10.12.86.116 iso.3.6.1.2.1
Perform snmpwalk as mentioned below with IPv4 address using SNMPv3 for R3:
snmpwalk -v 3 -u user2 -l auth -r 0 -t 10 -n "context2" -a MD5 -A password 10.12.86.132 iso.3.6.1.2.1