Just to get it on the record, I assume you know that the cogent route would become active even at lower preference after your primary peer goes down. It would take a couple minutes as the peer doing down will withdraw the primary route from Lumen after 90 seconds or faster if BFD is on that link. From there the route withdrawal update would go to their peers like cogent. And then the lower pref is active with no action needed.
There is no built in feature for the process to change policy with a bgp failure event. So you will need to setup the following.
* detect the lumen peer down
* change and commit the new cogent policy
* detect the lumen peer restore
* change and commit the original cogent policy
So this will be an automation project. The detect phases would use event scripts. You will look for the specific bgp up/down messages in the log for the and use them to trigger your script. This will require some care. When a bgp peer is down it will cycle through a multiple message attempt to re-establish the peer and you won't want your triggered script running all the time attempting to change the status and your script running all the time during an outage.
Another option is to pick an interval like every 5 minutes and check the peer status. But this is really no better than the default actions I noted above. So finding the singular reliable trigger event will be important.
https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/concept/junos-script-automation-event-script-overview.htmlAfter that you can use a python on box script to do your configuration change and commit. Junos 18 or greater is required for this and with version 20.2 you get python 3 with more features.
https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/concept/junos-python-modules-on-device.html------------------------------
Steve Puluka BSEET - Juniper Ambassador
IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
http://puluka.com/home------------------------------
Original Message:
Sent: 01-07-2022 18:36
From: Unknown User
Subject: Change Community Advertise to backup ISP upon failover
I've got a customer that wants to use local preference community string out to Cogent to force that to be their backup inbound traffic direction; however, they want to dynamically change this local preference if a failure is detected in their primary ISP Lumen.
Is there a way in configuration, or script to automate the changing of the BGP community string advertisement out to Cogent?
Also if you have any examples of the failure detection used in primary ISP.
2 MX 204's at edge
MX204-1 has primary and secondary eBGP links to lumen
MX204-2 has single eBGP connection to Cogent
IBGP running between the two MX204's.
Thanks,
Kevin