Ospf
This scenario shows how to configure the OSPF protocol and monitor its status using the SNMP protocol.
Test OSPF SNMP OIDs
Description
This example shows how to monitor BGP stats in a scenario with iBGP and dynamic neighbors.
Scenario
Step 1: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address 10.0.0.50/24 set protocols ospf area 0.0.0.1 network 10.0.0.0/24 set service snmp community TEST set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1
:
set interfaces dummy dum0 address 1.1.1.1/24 set interfaces ethernet eth0 address 10.0.0.100/24 set protocols ospf area 0.0.0.1 network 10.0.0.0/24 set protocols ospf redistribute connected route-map INTERNAL set protocols route-map INTERNAL rule 1 action permit set protocols route-map INTERNAL rule 1 match interface dum0 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Run command protocols ospf show neighbor
at DUT0
and check if output matches the following regular expressions:
10.0.0.50
Show output
Neighbor ID Pri State Up Time Dead Time Address Interface RXmtL RqstL DBsmL 10.0.0.100 1 Init/DROther 0.213s 39.786s 10.0.0.100 eth0:10.0.0.50 0 0 0
Step 4: Run command protocols ip show route
at DUT0
and check if output matches the following regular expressions:
1.1.1.0/24Show output
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR, f - OpenFabric, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure O>* 1.1.1.0/24 [110/20] via 10.0.0.100, eth0, weight 1, 00:00:01 O 10.0.0.0/24 [110/1] is directly connected, eth0, weight 1, 00:00:53 C>* 10.0.0.0/24 is directly connected, eth0, 00:00:54
Step 5: Ping IP address 1.1.1.1
from DUT0
:
admin@DUT0$ ping 1.1.1.1 count 1 size 56 timeout 1Show output
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.204 ms --- 1.1.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.204/0.204/0.204/0.000 ms
Step 6: Run command service snmp walk local-agent v1 TEST oid 1.3.6.1.2.1.14
at DUT0
and check if output matches the following regular expressions:
OSPF-MIB::ospfNbrIpAddr\.10.0.0\.100\.0 = IpAddress: 10.0.0\.100 OSPF-MIB::ospfNbrPriority\.10.0.0\.100\.0 = INTEGER: 1 OSPF-MIB::ospfNbrState.10.0.0\.100\.0 = INTEGER: full\(8\) OSPF-MIB::ospfNbrEvents.10.0.0\.100\.0 = Counter32: \d+ OSPF-MIB::ospfIfIpAddress.10.0.0\.50\.0 = IpAddress: 10.0.0\.50 OSPF-MIB::ospfIfState.10.0.0\.50\.0 = INTEGER: backupDesignatedRouter\(6\) OSPF-MIB::ospfAreaId\.0\.0\.0\.1 = IpAddress: 0\.0\.0\.1 OSPF-MIB::ospfAreaBdrRtrCount\.0\.0\.0\.1 = Gauge32: 0 OSPF-MIB::ospfAsBdrRtrCount\.0\.0\.0\.1 = Gauge32: 1Show output
OSPF-MIB::ospfRouterId.0 = IpAddress: 10.0.0.50 OSPF-MIB::ospfAdminStat.0 = INTEGER: enabled(1) OSPF-MIB::ospfVersionNumber.0 = INTEGER: version2(2) OSPF-MIB::ospfAreaBdrRtrStatus.0 = INTEGER: false(2) OSPF-MIB::ospfASBdrRtrStatus.0 = INTEGER: false(2) OSPF-MIB::ospfExternLsaCount.0 = Gauge32: 1 OSPF-MIB::ospfExternLsaCksumSum.0 = INTEGER: 0 OSPF-MIB::ospfTOSSupport.0 = INTEGER: false(2) OSPF-MIB::ospfOriginateNewLsas.0 = Counter32: 1 OSPF-MIB::ospfRxNewLsas.0 = Counter32: 4 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::ospfAreaId.0.0.0.1 = IpAddress: 0.0.0.1 OSPF-MIB::ospfAuthType.0.0.0.1 = INTEGER: none(0) OSPF-MIB::ospfImportAsExtern.0.0.0.1 = INTEGER: importExternal(1) OSPF-MIB::ospfSpfRuns.0.0.0.1 = Counter32: 3 OSPF-MIB::ospfAreaBdrRtrCount.0.0.0.1 = Gauge32: 0 OSPF-MIB::ospfAsBdrRtrCount.0.0.0.1 = Gauge32: 1 OSPF-MIB::ospfAreaLsaCount.0.0.0.1 = Gauge32: 3 OSPF-MIB::ospfAreaLsaCksumSum.0.0.0.1 = INTEGER: 0 OSPF-MIB::ospfAreaSummary.0.0.0.1 = INTEGER: sendAreaSummary(2) OSPF-MIB::ospfAreaStatus.0.0.0.1 = INTEGER: active(1) OSPF-MIB::ospfLsdbAreaId.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = IpAddress: 0.0.0.1 OSPF-MIB::ospfLsdbAreaId.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = IpAddress: 0.0.0.1 OSPF-MIB::ospfLsdbAreaId.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = IpAddress: 0.0.0.1 OSPF-MIB::ospfLsdbType.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = INTEGER: routerLink(1) OSPF-MIB::ospfLsdbType.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = INTEGER: routerLink(1) OSPF-MIB::ospfLsdbType.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = INTEGER: networkLink(2) OSPF-MIB::ospfLsdbLsid.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = IpAddress: 10.0.0.50 OSPF-MIB::ospfLsdbLsid.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = IpAddress: 10.0.0.100 OSPF-MIB::ospfLsdbLsid.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = IpAddress: 10.0.0.100 OSPF-MIB::ospfLsdbRouterId.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = IpAddress: 10.0.0.50 OSPF-MIB::ospfLsdbRouterId.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = IpAddress: 10.0.0.100 OSPF-MIB::ospfLsdbRouterId.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = IpAddress: 10.0.0.100 OSPF-MIB::ospfLsdbSequence.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = INTEGER: 67108992 OSPF-MIB::ospfLsdbSequence.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = INTEGER: 67108992 OSPF-MIB::ospfLsdbSequence.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = INTEGER: 16777344 OSPF-MIB::ospfLsdbAge.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = INTEGER: 0 seconds OSPF-MIB::ospfLsdbAge.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = INTEGER: 2560 seconds OSPF-MIB::ospfLsdbAge.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = INTEGER: 256 seconds OSPF-MIB::ospfLsdbChecksum.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = INTEGER: 1575 OSPF-MIB::ospfLsdbChecksum.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = INTEGER: 52168 OSPF-MIB::ospfLsdbChecksum.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = INTEGER: 19590 OSPF-MIB::ospfLsdbAdvertisement.0.0.0.1.routerLink.10.0.0.50.10.0.0.50 = Hex-STRING: 00 00 02 01 0A 00 00 32 0A 00 00 32 80 00 00 04 27 06 00 24 00 00 00 01 0A 00 00 64 0A 00 00 32 02 00 00 01 OSPF-MIB::ospfLsdbAdvertisement.0.0.0.1.routerLink.10.0.0.100.10.0.0.100 = Hex-STRING: 00 0A 02 01 0A 00 00 64 0A 00 00 64 80 00 00 04 C8 CB 00 24 02 00 00 01 0A 00 00 64 0A 00 00 64 02 00 00 01 OSPF-MIB::ospfLsdbAdvertisement.0.0.0.1.networkLink.10.0.0.100.10.0.0.100 = Hex-STRING: 00 01 02 02 0A 00 00 64 0A 00 00 64 80 00 00 01 86 4C 00 20 FF FF FF 00 0A 00 00 32 0A 00 00 64 OSPF-MIB::ospfIfIpAddress.10.0.0.50.0 = IpAddress: 10.0.0.50 OSPF-MIB::ospfAddressLessIf.10.0.0.50.0 = INTEGER: 0 OSPF-MIB::ospfIfAreaId.10.0.0.50.0 = IpAddress: 0.0.0.1 OSPF-MIB::ospfIfType.10.0.0.50.0 = INTEGER: broadcast(1) OSPF-MIB::ospfIfAdminStat.10.0.0.50.0 = INTEGER: enabled(1) OSPF-MIB::ospfIfRtrPriority.10.0.0.50.0 = INTEGER: 1 OSPF-MIB::ospfIfTransitDelay.10.0.0.50.0 = INTEGER: 1 seconds OSPF-MIB::ospfIfRetransInterval.10.0.0.50.0 = INTEGER: 5 seconds OSPF-MIB::ospfIfHelloInterval.10.0.0.50.0 = INTEGER: 10 seconds OSPF-MIB::ospfIfRtrDeadInterval.10.0.0.50.0 = INTEGER: 40 seconds OSPF-MIB::ospfIfPollInterval.10.0.0.50.0 = INTEGER: 60 seconds OSPF-MIB::ospfIfState.10.0.0.50.0 = INTEGER: backupDesignatedRouter(6) OSPF-MIB::ospfIfDesignatedRouter.10.0.0.50.0 = IpAddress: 10.0.0.100 OSPF-MIB::ospfIfBackupDesignatedRouter.10.0.0.50.0 = IpAddress: 10.0.0.50 OSPF-MIB::ospfIfEvents.10.0.0.50.0 = Counter32: 3 OSPF-MIB::ospfIfAuthKey.10.0.0.50.0 = "" OSPF-MIB::ospfIfStatus.10.0.0.50.0 = INTEGER: active(1) OSPF-MIB::ospfIfMulticastForwarding.10.0.0.50.0 = INTEGER: blocked(1) OSPF-MIB::ospfIfDemand.10.0.0.50.0 = INTEGER: false(2) OSPF-MIB::ospfIfAuthType.10.0.0.50.0 = INTEGER: none(0) OSPF-MIB::ospfIfMetricIpAddress.10.0.0.50.0.1 = IpAddress: 10.0.0.50 OSPF-MIB::ospfIfMetricAddressLessIf.10.0.0.50.0.1 = INTEGER: 0 OSPF-MIB::ospfIfMetricTOS.10.0.0.50.0.1 = INTEGER: 0 OSPF-MIB::ospfIfMetricValue.10.0.0.50.0.1 = INTEGER: 1 OSPF-MIB::ospfIfMetricStatus.10.0.0.50.0.1 = INTEGER: active(1) OSPF-MIB::ospfNbrIpAddr.10.0.0.100.0 = IpAddress: 10.0.0.100 OSPF-MIB::ospfNbrAddressLessIndex.10.0.0.100.0 = INTEGER: 0 OSPF-MIB::ospfNbrRtrId.10.0.0.100.0 = IpAddress: 10.0.0.100 OSPF-MIB::ospfNbrOptions.10.0.0.100.0 = INTEGER: 2 OSPF-MIB::ospfNbrPriority.10.0.0.100.0 = INTEGER: 1 OSPF-MIB::ospfNbrState.10.0.0.100.0 = INTEGER: full(8) OSPF-MIB::ospfNbrEvents.10.0.0.100.0 = Counter32: 6 OSPF-MIB::ospfNbrLsRetransQLen.10.0.0.100.0 = Gauge32: 0 OSPF-MIB::ospfNbmaNbrStatus.10.0.0.100.0 = INTEGER: active(1) OSPF-MIB::ospfNbmaNbrPermanence.10.0.0.100.0 = INTEGER: permanent(2) OSPF-MIB::ospfNbrHelloSuppressed.10.0.0.100.0 = INTEGER: false(2) OSPF-MIB::ospfExtLsdbType.asExternalLink.1.1.1.0.10.0.0.100 = INTEGER: asExternalLink(5) OSPF-MIB::ospfExtLsdbLsid.asExternalLink.1.1.1.0.10.0.0.100 = IpAddress: 1.1.1.0 OSPF-MIB::ospfExtLsdbRouterId.asExternalLink.1.1.1.0.10.0.0.100 = IpAddress: 10.0.0.100 OSPF-MIB::ospfExtLsdbSequence.asExternalLink.1.1.1.0.10.0.0.100 = INTEGER: 16777344 OSPF-MIB::ospfExtLsdbAge.asExternalLink.1.1.1.0.10.0.0.100 = INTEGER: 10496 seconds OSPF-MIB::ospfExtLsdbChecksum.asExternalLink.1.1.1.0.10.0.0.100 = INTEGER: 31442 OSPF-MIB::ospfExtLsdbAdvertisement.asExternalLink.1.1.1.0.10.0.0.100 = Hex-STRING: 00 29 02 05 01 01 01 00 0A 00 00 64 80 00 00 01 D2 7A 00 24 FF FF FF 00 80 00 00 14 00 00 00 00 00 00 00 00