Page 1 of 1

bgp peer switch script

Posted: Thu May 08, 2014 7:42 pm
by plisken
Hello, I have nodes with 2 uplinks for redundantie
I have two bgp peers on the node peer 1 is enabled peer 2 is disabeld
Now a want a script that if bgp peer 1 go down peer 2 would be enabled
And vice versa if bgp peer go's back online that bgp peer2 becomes disable

Any a idee?

Re: bgp peer switch script

Posted: Thu May 08, 2014 9:21 pm
by c0d3rSh3ll
how are you enabling and disabling each peer?

Re: bgp peer switch script

Posted: Thu May 08, 2014 9:27 pm
by plisken
I want a script at failure of the bgp peer.I don't want it self off
Thanks for reply

Re: bgp peer switch script

Posted: Fri May 09, 2014 2:18 pm
by plisken
with command in script

/routing bgp peer enable

/routing bgp peer disable

But i want that the script see that peer1 is down and enable automatic peer2
and vice versa if peer1 back online that peer2 disable

Something with netwatch ore so

how are you enabling and disabling each peer?

Re: bgp peer switch script

Posted: Fri May 09, 2014 6:01 pm
by plisken
:if ([/routing bgp peer get [find name="xxx"] state] != "established") do={ .. send email here...}
In the place of email I would like to enable bgp peer2.

I want also in place of establisched that bgp peer is down
How write te script

Re: bgp peer switch script

Posted: Mon Sep 15, 2014 12:37 pm
by plisken
Anybody can help?

Re: bgp peer switch script

Posted: Fri Sep 26, 2014 3:53 pm
by plisken
Nowbody has a idee :(

Re: bgp peer switch script

Posted: Fri Sep 26, 2014 5:23 pm
by psamsig
I have no experience with BGP, but here is a go:
/routing bgp peer {
    :local priPeerState [get [:pick [find name="Primary"] 0] state]
    :local secPeer [:pick [find name="Secondary"] 0]
    :local secPeerDisabled [get $secPeer disabled]
    :if ($priPeerState != "established") do={
        :if ($secPeerDisabled = true) do={
            enable $secPeer
        }
    } else={
        :if ($secPeerDisabled = false) do={
            disable $secPeer
        }
    }
}

Re: bgp peer switch script

Posted: Fri Sep 26, 2014 5:29 pm
by plisken
Thanks, i try this and let you know if this works.