BGP Neighbor Down monitoring


#1

Hello all ,

As BFD is not supported yet , is there a way somehow to re-route as fast as possible traffic that goes to a dead neighbor ? I have 3 upstream providers with full routing table from all of them. Some times one of my providers seems to have problems . They have keep alive and hold timers to default cisco settings (180sec) which is catastrophic for me because for 3 minutes traffic is send to a dead neighbor with the results you all can imagine . Any ideas ?

Thanks


#2

I had the same problem when I administered routers at various internet exchanges. I ended up using a script like the following. It would log in at some set interval and either look for an arp entry or ping something reliable. If it didn’t get the proper result it would shutdown the BGP peer.

#!/usr/bin/python3

import pexpect, time

userName = 'vyos'
passWord = 'vyos'
deviceName = '192.168.10.51'
tgtINT = 'eth0'
tgtMAC = '00:02:00:00:00:01'
tgtIP = '192.168.10.69'
prompt = '\:\~\$'
configPrompt = 'vyos#'

def DisplayText(VAR, VAR2):
    bZ = (VAR + VAR2)
    Z = bytes.decode(bZ)
    A = Z.splitlines()
    for i in A:
        print(i)

S = pexpect.spawn('ssh -o StrictHostKeyChecking=no ' + userName + '@' + deviceName)
S.expect('word:')
DisplayText(S.before, S.after)

S.sendline(passWord)
S.expect(prompt)
DisplayText(S.before, S.after)

S.sendline('reset ip arp address ' + tgtIP)
S.expect(prompt)
DisplayText(S.before, S.after)

time.sleep(2)

S.sendline('show arp ' + tgtINT + ' | match ' + tgtIP)
S.expect(prompt)
arpQuery = S.before
DisplayText(S.before, S.after)

if tgtMAC not in bytes.decode(arpQuery):
    S.sendline('configure')
    S.expect(configPrompt)
    DisplayText(S.before, S.after)

    S.sendline('set protocols bgp 65001 neighbor 10.10.1.1 shutdown')
    S.expect(configPrompt)
    DisplayText(S.before, S.after)

    S.sendline('commit')
    S.expect(configPrompt)
    DisplayText(S.before, S.after)

    S.sendline('exit')
    S.expect(prompt)
    DisplayText(S.before, S.after)

S.sendline('exit')
S.close()