Community discussions

MikroTik App
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

bgp peer switch script

Thu May 08, 2014 7:42 pm

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?
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 558
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: bgp peer switch script

Thu May 08, 2014 9:21 pm

how are you enabling and disabling each peer?
nothing
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Thu May 08, 2014 9:27 pm

I want a script at failure of the bgp peer.I don't want it self off
Thanks for reply
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Fri May 09, 2014 2:18 pm

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?
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Fri May 09, 2014 6:01 pm

: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
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Mon Sep 15, 2014 12:37 pm

Anybody can help?
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Fri Sep 26, 2014 3:53 pm

Nowbody has a idee :(
 
psamsig
Member Candidate
Member Candidate
Posts: 161
Joined: Sun Dec 06, 2009 1:36 pm
Location: Denmark

Re: bgp peer switch script

Fri Sep 26, 2014 5:23 pm

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
        }
    }
}
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2453
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: bgp peer switch script

Fri Sep 26, 2014 5:29 pm

Thanks, i try this and let you know if this works.

Who is online

Users browsing this forum: BlackXstar and 33 guests