Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Cisco > Batch Cisco Configuration Script

Reply
Thread Tools

Batch Cisco Configuration Script

 
 
Paul Thomas
Guest
Posts: n/a
 
      06-26-2007
I've seen a script a few years ago that would automate the
configuration of many routers but now I cannot find it unfortunately.
The way the script would work is as follows. I can't use Kiwi Cat
Tools because I have more than 5 devices and no budget for this
project and also I would really like to use this from unix.

The user would create the items to be placed into the config exactly
as you would type them if you were telnet/ssh in (including any no
commands if needed). You would place these commands into a plain text
file with the filename being the device hostname/ip. When you ran the
script you would pass it a directory and the script would telnet to
each device (obtained from the filename) then send that file to the
open telnet session.

tFTP isn't an option for me as this is a lab environment with no
access other than a termserv. I cannot put the configs on a file
server / router in the lab as there isn't always connectivity to all
devices. The only constant access to the devices is telnetting to a
termserv. Security isn't a concern either.

Google isn't giving me any love on this one and I'm trying to avoid
recreating the will using Net::Telnet[::Cisco] if I don't have to.

 
Reply With Quote
 
 
 
 
Christophe Fillot
Guest
Posts: n/a
 
      06-26-2007
Paul Thomas a écrit :
> I've seen a script a few years ago that would automate the
> configuration of many routers but now I cannot find it unfortunately.
> The way the script would work is as follows. I can't use Kiwi Cat
> Tools because I have more than 5 devices and no budget for this
> project and also I would really like to use this from unix.
>
> The user would create the items to be placed into the config exactly
> as you would type them if you were telnet/ssh in (including any no
> commands if needed). You would place these commands into a plain text
> file with the filename being the device hostname/ip. When you ran the
> script you would pass it a directory and the script would telnet to
> each device (obtained from the filename) then send that file to the
> open telnet session.
>
> tFTP isn't an option for me as this is a lab environment with no
> access other than a termserv. I cannot put the configs on a file
> server / router in the lab as there isn't always connectivity to all
> devices. The only constant access to the devices is telnetting to a
> termserv. Security isn't a concern either.
>
> Google isn't giving me any love on this one and I'm trying to avoid
> recreating the will using Net::Telnet[::Cisco] if I don't have to.


IIRC, it could be "CiscoT", that you can find here:

ftp://ftp.ripe.net/pride/tools/contrib.tar.gz

Hope this helps.
 
Reply With Quote
 
 
 
 
Paul Thomas
Guest
Posts: n/a
 
      06-26-2007
On Jun 26, 12:02 pm, Christophe Fillot <(E-Mail Removed)> wrote:
> Paul Thomas a écrit :
>
>
>
> > I've seen a script a few years ago that would automate the
> > configuration of many routers but now I cannot find it unfortunately.
> > The way the script would work is as follows. I can't use Kiwi Cat
> > Tools because I have more than 5 devices and no budget for this
> > project and also I would really like to use this from unix.

>
> > The user would create the items to be placed into the config exactly
> > as you would type them if you were telnet/ssh in (including any no
> > commands if needed). You would place these commands into a plain text
> > file with the filename being the device hostname/ip. When you ran the
> > script you would pass it a directory and the script would telnet to
> > each device (obtained from the filename) then send that file to the
> > open telnet session.

>
> > tFTP isn't an option for me as this is a lab environment with no
> > access other than a termserv. I cannot put the configs on a file
> > server / router in the lab as there isn't always connectivity to all
> > devices. The only constant access to the devices is telnetting to a
> > termserv. Security isn't a concern either.

>
> > Google isn't giving me any love on this one and I'm trying to avoid
> > recreating the will using Net::Telnet[::Cisco] if I don't have to.

>
> IIRC, it could be "CiscoT", that you can find here:
>
> ftp://ftp.ripe.net/pride/tools/contrib.tar.gz
>
> Hope this helps.


Thanks for the prompt reply but that's not what I was looking for.
Here is an example.

The following files are in /tmp/cisco/changes
cat host1
conf t
no ip access-list 10
ip access-list 10 permit ip any any
end
wr me

##
cat host2
conf t
no ip access-list 10
ip access-list 10 permit ip any any
end
wr me

I would then type 'pushchanges /tmp/cisco/changes' and it would log
into routers, enter enable mode, then cat the text to the telnet
session. I made up the name pushchanges and I have no idea what
language that script was written in.

I expect I'll be writing some perl to do this but just trying not to
re-invent the wheel....especially since I'm not a fast (or good)
programmer.

 
Reply With Quote
 
Sam Wilson
Guest
Posts: n/a
 
      06-27-2007
In article <(E-Mail Removed). com>,
Paul Thomas <(E-Mail Removed)> wrote:

> ...
> I would then type 'pushchanges /tmp/cisco/changes' and it would log
> into routers, enter enable mode, then cat the text to the telnet
> session. I made up the name pushchanges and I have no idea what
> language that script was written in.
>
> I expect I'll be writing some perl to do this but just trying not to
> re-invent the wheel....especially since I'm not a fast (or good)
> programmer.


We use an expect script to do this kind of thing, but I'd be slightly
embarrassed to pass it on. (And I didn't write it, though that's not a
boast that I'd have done any better.)

Sam
 
Reply With Quote
 
Adriano Prado
Guest
Posts: n/a
 
      06-27-2007
On 27 jun, 05:41, Sam Wilson <(E-Mail Removed)> wrote:
> In article <(E-Mail Removed). com>,
> Paul Thomas <(E-Mail Removed)> wrote:
>
> > ...
> > I would then type 'pushchanges /tmp/cisco/changes' and it would log
> > into routers, enter enable mode, then cat the text to the telnet
> > session. I made up the name pushchanges and I have no idea what
> > language that script was written in.

>
> > I expect I'll be writing some perl to do this but just trying not to
> > re-invent the wheel....especially since I'm not a fast (or good)
> > programmer.

>
> We use an expect script to do this kind of thing, but I'd be slightly
> embarrassed to pass it on. (And I didn't write it, though that's not a
> boast that I'd have done any better.)
>
> Sam


Paul,

Here follow a simple example of a expect script. It only logs into the
router and then give the prompt back to the user (that is what the
interact command does). You pass the IP of target as parameter
(scriptname.exp 10.10.10.10).

But you can improve it to send the strings you need... 'send' command
simulates a user typing and 'expect' waits for that string... well, I
suggest you reading the Expect/Tcl docs so you can pass parameters to
the script.

the script:
--------------------
#!/usr/local/bin/expect

spawn telnet $argv

expect "Username:"
send "johndoe\r"

expect "Password:"
send "secret\r"

expect "\>"
send "en\r"

expect "Password:"
send "zekret\r"

interact
--------------------

Regards,
Adriano

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Cisco 3800 + Cisco ASA 5540 configuration ejohnson1341@gmail.com Cisco 2 09-29-2007 01:13 AM
Execute batch script on remote computer py Python 0 02-13-2006 03:53 PM
batch tiff to jpeg conversion script rtilley@vt.edu Python 11 01-30-2006 03:50 AM
replacing batch file with python script SeeBelow@SeeBelow.Nut Python 3 10-27-2004 07:27 AM
Running batch script from ASP.NET page John McGinty ASP .Net 3 09-28-2004 03:41 PM



Advertisments