Bgp Snmp Monitor
This scenario shows how to configure the BGP protocol and monitor its status using the SNMP protocol.
Test iBGP 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 DUT1
:
set interfaces dummy dum0 address 1.1.1.1/24 set interfaces ethernet eth0 address 10.10.0.200/24 set protocols bgp 20 peer-group overlay listen range 10.10.0.0/24 set protocols bgp 20 peer-group overlay remote-as 20 set protocols bgp 20 redistribute connected route-map REDIS set protocols route-map REDIS rule 1 action permit set protocols route-map REDIS rule 1 match interface dum0 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address 10.10.0.100/24 set protocols bgp 20 neighbor peer remote-address 10.10.0.200 set protocols bgp 20 neighbor peer remote-as 20 set service snmp community TEST set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Run command protocols bgp show ip summary
at DUT0
and check if output contains the following tokens:
10.10.0.200
Show output
IPv4 Unicast Summary (VRF default): BGP router identifier 10.10.0.100, local AS number 20 vrf-id 0 BGP table version 0 RIB entries 0, using 0 bytes of memory Peers 1, using 725 KiB of memory Neighbor LocalAddr V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State PfxRcd PfxSnt Desc 10.10.0.200 - 4 20 0 0 0 0 0 never Idle 0 0 N/A Total number of neighbors 1
Step 4: Run command protocols bgp show ip
at DUT0
and check if output contains the following tokens:
1.1.1.0/24Show output
BGP table version is 1, local router ID is 10.10.0.100, vrf id 0 Default local pref 100, local AS 20 local address - Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 10.10.0.200 0 100 0 ? Displayed 1 routes and 1 total paths
Step 5: Run command protocols ip show route
at DUT0
and check if output contains the following tokens:
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 B>* 1.1.1.0/24 [200/0] via 10.10.0.200, eth0, weight 1, 00:00:01 C>* 10.10.0.0/24 is directly connected, eth0, 00:00:03
Step 6: 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.194 ms --- 1.1.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.194/0.194/0.194/0.000 ms
Step 7: Run command service snmp walk local-agent v1 TEST oid 1.3.6.1.2.1.15
at DUT0
and check if output matches the following regular expressions:
BGP4-MIB::bgpPeerIdentifier\.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgpPeerState\.10.10.0.200 = INTEGER: established\(6\) BGP4-MIB::bgpPeerAdminStatus\.10.10.0.200 = INTEGER: start\(2\) BGP4-MIB::bgpPeerNegotiatedVersion\.10.10.0.200 = INTEGER: 4 BGP4-MIB::bgpPeerFsmEstablishedTransitions.10.10.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerFsmEstablishedTime.10.10.0.200 = Gauge32: [1-9]\d* BGP4-MIB::bgpPeerInUpdates.10.10.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerOutUpdates.10.10.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerInTotalMessages.10.10.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerOutTotalMessages.10.10.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerRemoteAddr.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgpPeerRemotePort.10.10.0.200 = INTEGER: 179 BGP4-MIB::bgpPeerRemoteAs.10.10.0.200 = INTEGER: 20Show output
BGP4-MIB::bgpVersion.0 = Hex-STRING: 10 BGP4-MIB::bgpLocalAs.0 = INTEGER: 20 BGP4-MIB::bgpPeerIdentifier.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgpPeerState.10.10.0.200 = INTEGER: established(6) BGP4-MIB::bgpPeerAdminStatus.10.10.0.200 = INTEGER: start(2) BGP4-MIB::bgpPeerNegotiatedVersion.10.10.0.200 = INTEGER: 4 BGP4-MIB::bgpPeerLocalAddr.10.10.0.200 = IpAddress: 10.10.0.100 BGP4-MIB::bgpPeerLocalPort.10.10.0.200 = INTEGER: 40616 BGP4-MIB::bgpPeerRemoteAddr.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgpPeerRemotePort.10.10.0.200 = INTEGER: 179 BGP4-MIB::bgpPeerRemoteAs.10.10.0.200 = INTEGER: 20 BGP4-MIB::bgpPeerInUpdates.10.10.0.200 = Counter32: 2 BGP4-MIB::bgpPeerOutUpdates.10.10.0.200 = Counter32: 1 BGP4-MIB::bgpPeerInTotalMessages.10.10.0.200 = Counter32: 4 BGP4-MIB::bgpPeerOutTotalMessages.10.10.0.200 = Counter32: 3 BGP4-MIB::bgpPeerLastError.10.10.0.200 = Hex-STRING: 00 00 BGP4-MIB::bgpPeerFsmEstablishedTransitions.10.10.0.200 = Counter32: 1 BGP4-MIB::bgpPeerFsmEstablishedTime.10.10.0.200 = Gauge32: 15 BGP4-MIB::bgpPeerConnectRetryInterval.10.10.0.200 = INTEGER: 120 BGP4-MIB::bgpPeerHoldTime.10.10.0.200 = INTEGER: 180 BGP4-MIB::bgpPeerKeepAlive.10.10.0.200 = INTEGER: 60 BGP4-MIB::bgpPeerHoldTimeConfigured.10.10.0.200 = INTEGER: 180 BGP4-MIB::bgpPeerKeepAliveConfigured.10.10.0.200 = INTEGER: 60 BGP4-MIB::bgpPeerMinRouteAdvertisementInterval.10.10.0.200 = INTEGER: 0 BGP4-MIB::bgpPeerInUpdateElapsedTime.10.10.0.200 = Gauge32: 14 BGP4-MIB::bgpIdentifier.0 = IpAddress: 10.10.0.100 BGP4-MIB::bgp4PathAttrPeer.1.1.1.0.24.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgp4PathAttrIpAddrPrefixLen.1.1.1.0.24.10.10.0.200 = INTEGER: 24 BGP4-MIB::bgp4PathAttrIpAddrPrefix.1.1.1.0.24.10.10.0.200 = IpAddress: 1.1.1.0 BGP4-MIB::bgp4PathAttrOrigin.1.1.1.0.24.10.10.0.200 = INTEGER: egp(2) BGP4-MIB::bgp4PathAttrASPathSegment.1.1.1.0.24.10.10.0.200 = "" BGP4-MIB::bgp4PathAttrNextHop.1.1.1.0.24.10.10.0.200 = IpAddress: 10.10.0.200 BGP4-MIB::bgp4PathAttrMultiExitDisc.1.1.1.0.24.10.10.0.200 = INTEGER: 0 BGP4-MIB::bgp4PathAttrLocalPref.1.1.1.0.24.10.10.0.200 = INTEGER: 100 BGP4-MIB::bgp4PathAttrAtomicAggregate.1.1.1.0.24.10.10.0.200 = INTEGER: lessSpecificRrouteNotSelected(1) BGP4-MIB::bgp4PathAttrAggregatorAS.1.1.1.0.24.10.10.0.200 = INTEGER: 0 BGP4-MIB::bgp4PathAttrAggregatorAddr.1.1.1.0.24.10.10.0.200 = IpAddress: 0.0.0.0 BGP4-MIB::bgp4PathAttrCalcLocalPref.1.1.1.0.24.10.10.0.200 = INTEGER: -1 BGP4-MIB::bgp4PathAttrBest.1.1.1.0.24.10.10.0.200 = INTEGER: true(2)
Test eBGP SNMP OIDs
Description
This example shows how to monitor BGP stats in a scenario with eBGP and dynamic neighbors.
Scenario
Step 1: Set the following configuration in DUT2
:
set interfaces ethernet eth0 address 10.10.0.101/24 set interfaces ethernet eth1 address 20.20.0.201/24 set protocols static route 1.1.1.0/24 next-hop 20.20.0.200 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 20.20.0.200/24 set protocols bgp 20 peer-group overlay ebgp-multihop 2 set protocols bgp 20 peer-group overlay listen range 10.10.0.0/24 set protocols bgp 20 peer-group overlay remote-as 10 set protocols bgp 20 peer-group overlay route-map export PERMIT set protocols bgp 20 redistribute connected route-map REDIS set protocols route-map PERMIT rule 1 action permit set protocols route-map REDIS rule 1 action permit set protocols route-map REDIS rule 1 match interface dum0 set protocols static route 10.10.0.0/24 next-hop 20.20.0.201 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address 10.10.0.100/24 set protocols bgp 10 neighbor peer ebgp-multihop 2 set protocols bgp 10 neighbor peer remote-address 20.20.0.200 set protocols bgp 10 neighbor peer remote-as 20 set protocols bgp 10 neighbor peer route-map import PERMIT set protocols route-map PERMIT rule 1 action permit set protocols static route 20.20.0.0/24 next-hop 10.10.0.101 set service snmp community TEST set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 4: Run command protocols bgp show ip summary
at DUT0
and check if output contains the following tokens:
20.20.0.200
Show output
IPv4 Unicast Summary (VRF default): BGP router identifier 10.10.0.100, local AS number 10 vrf-id 0 BGP table version 0 RIB entries 0, using 0 bytes of memory Peers 1, using 725 KiB of memory Neighbor LocalAddr V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State PfxRcd PfxSnt Desc 20.20.0.200 - 4 20 2 2 0 0 0 00:00:00 Established 0 (Policy) N/A Total number of neighbors 1
Step 5: Run command protocols bgp show ip
at DUT0
and check if output contains the following tokens:
1.1.1.0/24Show output
BGP table version is 1, local router ID is 10.10.0.100, vrf id 0 Default local pref 100, local AS 10 local address - Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 20.20.0.200 0 0 20 ? Displayed 1 routes and 1 total paths
Step 6: Run command protocols ip show route
at DUT0
and check if output contains the following tokens:
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 B> 1.1.1.0/24 [20/0] via 20.20.0.200 (recursive), weight 1, 00:00:00 * via 10.10.0.101, eth0, weight 1, 00:00:00 C>* 10.10.0.0/24 is directly connected, eth0, 00:00:02 S>* 20.20.0.0/24 [1/0] via 10.10.0.101, eth0, weight 1, 00:00:02
Step 7: 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=63 time=0.382 ms --- 1.1.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.382/0.382/0.382/0.000 ms
Step 8: Run command service snmp walk local-agent v1 TEST oid 1.3.6.1.2.1.15
at DUT0
and check if output matches the following regular expressions:
BGP4-MIB::bgpPeerIdentifier\.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgpPeerState\.20.20.0.200 = INTEGER: established\(6\) BGP4-MIB::bgpPeerAdminStatus\.20.20.0.200 = INTEGER: start\(2\) BGP4-MIB::bgpPeerNegotiatedVersion\.20.20.0.200 = INTEGER: 4 BGP4-MIB::bgpPeerFsmEstablishedTransitions.20.20.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerFsmEstablishedTime.20.20.0.200 = Gauge32: [1-9]\d* BGP4-MIB::bgpPeerInUpdates.20.20.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerOutUpdates.20.20.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerInTotalMessages.20.20.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerOutTotalMessages.20.20.0.200 = Counter32: [1-9]\d* BGP4-MIB::bgpPeerRemoteAddr.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgpPeerRemotePort.20.20.0.200 = INTEGER: 179 BGP4-MIB::bgpPeerRemoteAs.20.20.0.200 = INTEGER: 20Show output
BGP4-MIB::bgpVersion.0 = Hex-STRING: 10 BGP4-MIB::bgpLocalAs.0 = INTEGER: 10 BGP4-MIB::bgpPeerIdentifier.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgpPeerState.20.20.0.200 = INTEGER: established(6) BGP4-MIB::bgpPeerAdminStatus.20.20.0.200 = INTEGER: start(2) BGP4-MIB::bgpPeerNegotiatedVersion.20.20.0.200 = INTEGER: 4 BGP4-MIB::bgpPeerLocalAddr.20.20.0.200 = IpAddress: 10.10.0.100 BGP4-MIB::bgpPeerLocalPort.20.20.0.200 = INTEGER: 40636 BGP4-MIB::bgpPeerRemoteAddr.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgpPeerRemotePort.20.20.0.200 = INTEGER: 179 BGP4-MIB::bgpPeerRemoteAs.20.20.0.200 = INTEGER: 20 BGP4-MIB::bgpPeerInUpdates.20.20.0.200 = Counter32: 3 BGP4-MIB::bgpPeerOutUpdates.20.20.0.200 = Counter32: 1 BGP4-MIB::bgpPeerInTotalMessages.20.20.0.200 = Counter32: 7 BGP4-MIB::bgpPeerOutTotalMessages.20.20.0.200 = Counter32: 4 BGP4-MIB::bgpPeerLastError.20.20.0.200 = Hex-STRING: 00 00 BGP4-MIB::bgpPeerFsmEstablishedTransitions.20.20.0.200 = Counter32: 1 BGP4-MIB::bgpPeerFsmEstablishedTime.20.20.0.200 = Gauge32: 16 BGP4-MIB::bgpPeerConnectRetryInterval.20.20.0.200 = INTEGER: 120 BGP4-MIB::bgpPeerHoldTime.20.20.0.200 = INTEGER: 180 BGP4-MIB::bgpPeerKeepAlive.20.20.0.200 = INTEGER: 60 BGP4-MIB::bgpPeerHoldTimeConfigured.20.20.0.200 = INTEGER: 180 BGP4-MIB::bgpPeerKeepAliveConfigured.20.20.0.200 = INTEGER: 60 BGP4-MIB::bgpPeerMinRouteAdvertisementInterval.20.20.0.200 = INTEGER: 0 BGP4-MIB::bgpPeerInUpdateElapsedTime.20.20.0.200 = Gauge32: 15 BGP4-MIB::bgpIdentifier.0 = IpAddress: 10.10.0.100 BGP4-MIB::bgp4PathAttrPeer.1.1.1.0.24.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgp4PathAttrIpAddrPrefixLen.1.1.1.0.24.20.20.0.200 = INTEGER: 24 BGP4-MIB::bgp4PathAttrIpAddrPrefix.1.1.1.0.24.20.20.0.200 = IpAddress: 1.1.1.0 BGP4-MIB::bgp4PathAttrOrigin.1.1.1.0.24.20.20.0.200 = INTEGER: egp(2) BGP4-MIB::bgp4PathAttrASPathSegment.1.1.1.0.24.20.20.0.200 = Hex-STRING: 02 01 00 14 BGP4-MIB::bgp4PathAttrNextHop.1.1.1.0.24.20.20.0.200 = IpAddress: 20.20.0.200 BGP4-MIB::bgp4PathAttrMultiExitDisc.1.1.1.0.24.20.20.0.200 = INTEGER: 0 BGP4-MIB::bgp4PathAttrLocalPref.1.1.1.0.24.20.20.0.200 = INTEGER: 0 BGP4-MIB::bgp4PathAttrAtomicAggregate.1.1.1.0.24.20.20.0.200 = INTEGER: lessSpecificRrouteNotSelected(1) BGP4-MIB::bgp4PathAttrAggregatorAS.1.1.1.0.24.20.20.0.200 = INTEGER: 0 BGP4-MIB::bgp4PathAttrAggregatorAddr.1.1.1.0.24.20.20.0.200 = IpAddress: 0.0.0.0 BGP4-MIB::bgp4PathAttrCalcLocalPref.1.1.1.0.24.20.20.0.200 = INTEGER: -1 BGP4-MIB::bgp4PathAttrBest.1.1.1.0.24.20.20.0.200 = INTEGER: true(2)