08-25-2012 05:41 AM - edited 03-04-2019 05:22 PM
Is there a mechanism that will allow me to delay the redistribution of routese from BGP>OSPF and OSPF>BGP until the BGP Peer has been established for a set period of time, say 5 minutes?
08-25-2012 06:03 AM
You might be able to do this with an EEM script, but generally redistribution is immediate as soon as the routes appear in the routing table.
HTH,
John
*** Please rate useful posts ***
08-25-2012 06:46 AM
Not much experience with EEM scripts, but I'll look into it. I was thinking along the lines of using IP SLA to test reachability of the Peer.
08-25-2012 08:23 AM
I'm not aware of being able to do this with SLA, but you can use EEM. Here's a script (I haven't tested) that should work:
event manager applet RemoveRedist
event syslog pattern "%BGP.*neighbor 192.168.1.1.*Down"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "router bgp 1"
action 4.0 cli command "no redistribute ospf 1"
action 5.0 cli command "router ospf 1"
action 6.0 cli command "no redistribute bgp 1"
action 7.0 cli command "Redistribution has been removed"
event manager applet AddRedist
event tag bgp syslog pattern "%BGP.*neighbor 192.168.1.1.*Up"
event tag addRoute timer countdown 300
correlate event bgp and event addRoute
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "router bgp 1"
action 4.0 cli command "redistribute ospf 1 match internal external"
action 5.0 cli command "router ospf 1"
action 6.0 cli command "redistribute bgp 1 subnets"
action 7.0 cli command "Redistribution has been readded"
The part that I haven't been able to test is the correlation of events. I believe this should work in the sense that once the bgp neighbor comes back up and 5 minutes has passed, then the script will run and readd your redistribution lines to your routing processes. You'd want to substitute your BGP neighbor's IP for the addresses that I used above.
HTH,
John
**** Please rate useful posts ****
08-29-2012 10:34 AM
John,
You put me on the right track with the script. I've tested it in the lab, but was wondering if there was a way to put in a conditional loop that would restart the counter should the BGP peer relationship go down prior to the 5 minute counter elapsing.
--Anthony
08-30-2012 04:54 AM
Unfortunately, you may need to write a tcl script for this. I'm not 100% sure of a way to do it, so I'd like to refer you to the eem scripting forum:
https://supportforums.cisco.com/community/netpro/network-infrastructure/eem
Joseph Clarke is awesome in scripting for both tcl and eem. If you post the script that I gave you, he'd probably be able to reduce it down to 2 lines
HTH,
John
*** Please rate useful posts ***
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