03-09-2023 03:26 AM - edited 03-09-2023 05:35 AM
Hi,
is there a way that EEM script issues some commands and a way to read all its content and on some specific output results do some action.
For example
=================================================================
TEST#sh ip bgp nei 12.12.12.1 received-
BGP table version is 89, local router ID is 20.20.20.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 5.163.124.76/32 12.12.12.1 0 100 300 500 i
* 8.8.8.8/32 12.12.12.1 0 100 300 500 i
*> 10.10.10.1/32 12.12.12.1 0 0 100 i
r> 12.12.12.0/24 12.12.12.1 0 0 100 ?
*> 13.13.13.0/24 12.12.12.1 0 0 100 ?
* 95.219.6.15/32 12.12.12.1 0 100 300 500 i
*> 100.10.10.1/32 12.12.12.1 0 0 100 i
*> 200.10.10.1/32 12.12.12.1 0 0 100 i
Total number of prefixes 8
=======================================================
Router issue this command every one minutes and check only let say last line and check total number of prefix. if prefix are less then 2 then shut that neighbor else do normal operation.
Thanks
03-09-2023 04:15 AM
can I suggest something here, can you use conditional advertise or this solution is not suitable for your case ?
https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/16137-cond-adv.html
03-09-2023 04:45 AM
Hi,
Thanks for your support and reply,
I think on it that if i use a track and put a dummy route in my bgp table. if that route is there in my table i will do conditional advertisement. but the story comes to same Track. my problem revolves around the ISP services and I wants a way to monitor their services.
so what other solution i think might help is
1) I can ask ISP that whenever you have service outage problems, then simply shut my interface and my router will performs as expected through other ISP. But the downside for that is may be they track something that might never shut our side interface or it might shut it very often. so it will be a nightmare.
2) As my Loopbacks are advertised through ISP2 and in case my P2P link broke or their service went down, then loopback will not be Pingable from outside. so i will directly connect a router (R2) to my main router (Main) and R2 will be connected to several other independent internet sources and all it does is to Ping my Loopbacks through internet links not through direct connected links. the moment it loses that ping from multiple internet sources it will shut interface connected to Main router. Main routers will also monitor that connected interface to R2 and as it see it is down then it will remove/shut bgp peering or shut interface to isp.
other then that I am still looking for a way to solve the issue. so now if EEM script can do it.
Thanks
03-09-2023 09:03 AM
you can achieve this - but what state you like to enable BGP back again ? (I mean how do you know it restored ?)
Total number of prefixes 8 ( you can put this as variable and compare with new value and make the interface shutdown)
but as I mentioned you have other challenges.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide