Community discussions

MikroTik App
 
MarcB
just joined
Topic Author
Posts: 10
Joined: Thu Nov 28, 2013 11:59 am

show ip bgp summary

Thu Dec 12, 2013 7:27 pm

Hi Guys,
I have written a script that can be used and stored on the MiktoTik Routers that will allow you to do the same as the following Cisco commands:-
show ip bgp summary
show ip bgp ipv4 unicast summary
show ip bgp ipv6 unicast summary
show ip bgp summary | include 64500
show ip bgp ipv4 unicast summary | include 64500
show ip bgp ipv6 unicast summary | include 64500

You will need to paste the following into the router from a terminal window
/system script
add name="show bgp summary include" policy=ftp,winbox,api source=":if ( \$as = nil ) do={\r\
    \n\t/routing bgp peer\r\
    \n\t:do {\r\
    \n\t:put \"Neighbor \\t\\t  ASN \\t Prefix Limit \\t Passive \\t PfxRcd \\t   State \\t Up/Down\" \r\
    \n\t:foreach i in=[find instance=default] do={  :put \"\$[get \$i remote-address]   \\t \$[get \$i remote-as] \\t \$[get \$i max-prefix-limit] \\t\\t \$[get \$i passive] \\t\\t \$[get \$i prefix-count] \\t\\t \$[get \$i state] \\t \$[get \$i upti\
    me]\" } \r\
    \n\t}\r\
    \n} else={\r\
    \n\t/routing bgp peer\r\
    \n\t:do {\r\
    \n\t:put \"Neighbor \\t\\t  ASN \\t Prefix Limit \\t Passive \\t PfxRcd \\t   State \\t Up/Down\" \r\
    \n\t:foreach i in=[find remote-as=\$as] do={  :put \"\$[get \$i remote-address]   \\t \$[get \$i remote-as] \\t \$[get \$i max-prefix-limit] \\t\\t \$[get \$i passive] \\t\\t \$[get \$i prefix-count] \\t\\t \$[get \$i state] \\t \$[get \$i uptime\
    ]\" } \r\
    \n\t}\r\
    \n}\r\
    \n"
/system scheduler
add name="Show BGP Summary Schedule" on-event=":global shbgpsum [:parse [/system script get \"show bgp summary include\" source]]\r\
    \n" policy=reboot,read,write,policy,test,winbox start-time=startup
The to use the above you will either need to reboot you router or go to System > Scheduler and change the time on the interval setting so that the job will run once. Wait for it to run and then change it back to the default value of 00:00:00

Once the above has been done you will be able to use the following global command fro anywhere in a terminal window to print the information to the screen in the same way as Cisco devices do
$shbgpsum as=64500
$shbgpsum
Hope this helps someone.

Kind regards,
Marc
 
robertpenz
Member Candidate
Member Candidate
Posts: 104
Joined: Mon Oct 10, 2011 8:41 am

Re: show ip bgp summary

Fri Feb 28, 2014 11:12 am

Big Thx for this script!
 
User avatar
StubArea51
Trainer
Trainer
Posts: 1739
Joined: Fri Aug 10, 2012 6:46 am
Location: stubarea51.net
Contact:

Re: show ip bgp summary

Fri Feb 28, 2014 7:55 pm

Excellent! I use that show command a bunch in the Cisco world...nice to have an equivalent for RouterOS. Well done!
 
plisken
Forum Guru
Forum Guru
Posts: 2509
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: show ip bgp summary

Sun May 04, 2014 1:36 pm

Can you shown more comands that you can do with this script?

Ore is the 2 commands all what you can do?

Who is online

Users browsing this forum: No registered users and 30 guests