RE: question about bgp

From: Tyson Scott <tscott_at_ipexpert.com>
Date: Mon, 2 Aug 2010 15:16:48 -0400

Here is a free basic script written in expect

#!/usr/bin/expect
set line [lindex $argv 0]
set hostname [lindex [split $line ";"] 0]
set neighbs [lindex [split $line ";"] 1]
regsub -all ":" $neighbs " " neighbors
set neighbors

spawn /usr/bin/telnet $hostname
expect {
        "Username" {
                send "myusername\r"
                expect "myusername"
                exp_continue
                }
        "Password" {
                send "mypassword\r"
                exp_continue
                }
        -re "\[a-zA-Z\_\.0-9\-]+>" {
                send "enable\r"
                expect "enable"
                exp_continue
                }
        "\[a-zA-Z\_\.0-9\-]+#" { }
        timeout {
                puts "\n\nError on Login\n\n"
                exit 1
                }
        }

foreach i neighbors {
        send "clear ip bgp $i\r"
        expect "clear ip bgp $i"
        expect "#"
}
send "\r"
expect "#"
send "exit\r"
expect eof

create a file using the script above running on Linux with expect libraries
installed
To run it for example if the script was clear-neighbors.exp
Type
clear-neighbors;1.1.1.1;2.2.2.2:3.3.3.3:4.4.4.4:5.5.5.5

The first 1.1.1.1 is the device to connect to. The rest are the neighbors
to clear.

Obviously replace myusername with your real username and replace mypassword
with your password.
And if you have some crazy router names that are beyond my regular
expression above you will need to account for it.

Regards,
 
Tyson Scott - CCIE #13513 R&S, Security, and SP
Managing Partner / Sr. Instructor - IPexpert, Inc.
Mailto: tscott_at_ipexpert.com

-----Original Message-----
From: nobody_at_groupstudy.com [mailto:nobody_at_groupstudy.com] On Behalf Of Matt
Bentley
Sent: Saturday, July 31, 2010 8:12 PM
To: Fabian Pucciarelli
Cc: Derick Winkworth; ccielab_at_groupstudy.com; comserv_at_groupstudy.com
Subject: Re: question about bgp

Hi Fabian:

You could use a Kron job. That or if you have a program that can send
commands to routers at regular intervals. We used to use Voyance.

http://www.cisco.com/en/US/docs/ios/12_3/feature/guide/g_kron.html

Hope this helps,

Matt Bentley

On Sat, Jul 31, 2010 at 3:27 PM, Fabian Pucciarelli
<fabiangp_at_gmail.com>wrote:

> Very useful, i will research your suggestions except the mind reading
> script...... Thank you.
>
> Fabian
>
> On Sat, Jul 31, 2010 at 2:39 PM, Adrian Brayton <abrayton_at_gmail.com>
> wrote:
>
> > If it's really that big of a pain, just write a script and give it an
> alias
> > and when your done fire it off. What you are asking would be impossible
> > unless the IOS could read your mind and know when you are done editing
> the
> > prefix-list.
> >
> >
> >
> >
> > On Jul 31, 2010, at 4:24 PM, Derick Winkworth wrote:
> >
> > > Instead of using a prefix-list, tag the routes you want to
> redistribute
> > when
> > > you want to redistribute them. Then use a route-map to match on that
> > tag...
> > >
> > >
> > >
> > > ________________________________
> > > From: Fabian Pucciarelli <fabiangp_at_gmail.com>
> > > To: Cisco certification <ccielab_at_groupstudy.com>; Cisco certification
> > > <comserv_at_groupstudy.com>; Cisco certification <cisco_at_groupstudy.com>
> > > Sent: Sat, July 31, 2010 1:46:28 PM
> > > Subject: question about bgp
> > >
> > > I have a router configured with a prefix list that is updated very
> > > frequently. Is there any cisco bgp feature that will help avoid having
> to
> > > clear BGP soft every time that I update the filter? Thank you.
> > >
> > > Fabian
> > >
> > > _____________________________________________________________________
> > > Subscription information: http://www.groupstudy.com/list/comserv.html
> > >
> > >
> > > Blogs and organic groups at http://www.ccie.net
> > >
> > >
Received on Mon Aug 02 2010 - 15:16:48 ART

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 11:20:52 ART