Batch Cisco Configuration Script

Batch Cisco Configuration Script

NewsGroups | Search | Tools
 comp.dcom.sys.cisco  Post an article  get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content  add this group's latest topics to your Google content  YahooMyWeb Yahoo!  Google Google  Windows Live Favorites Windows Live  del.icio.us del.icio.us  digg digg  Add to Netscape Netscape
Subject Author Date
Batch Cisco Configuration Script Paul Thomas 06-26-2007
Posted by Paul Thomas on June 26, 2007, 12:29 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
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.


Posted by Christophe Fillot on June 26, 2007, 1:02 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
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.

Posted by Paul Thomas on June 26, 2007, 2:34 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
> Paul Thomas a =E9crit :
>
>
>
> > 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.


Posted by Sam Wilson on June 27, 2007, 4:41 am
If you were  Registered and logged in, you could reply and use other advanced thread options

> ...
> 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

Posted by Adriano Prado on June 27, 2007, 10:01 am
If you were  Registered and logged in, you could reply and use other advanced thread options
>
> > ...
> > 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


Similar ThreadsPosted
Switching VLAN configuration with a script from within the net January 29, 2005, 9:07 am
cisco vpnclient for cmd script April 30, 2008, 11:25 am
VBS script to backup Cisco configs December 1, 2005, 7:44 am
Cisco + Linux How to store configs in one script? August 8, 2006, 4:34 am
Host tracking on Cisco switch/routers using perl script February 7, 2007, 5:15 pm
Cisco 1700 Config not able to processing internal webmail script October 21, 2007, 8:31 pm
Cisco CSS load balance weighted round-robin perl script February 13, 2007, 9:30 pm
enabling/dissabling ip multicast traffic in real time on a Cisco router using windows script July 23, 2005, 9:10 pm
script April 5, 2004, 3:51 pm
script question February 3, 2006, 1:58 pm

other useful resources:
The Federal Communications Commission (FCC)
Telecommunications Industry Association
Electronic and Software Security Products and Services
International Telecommunication Union

Custom CGI Perl and PHP programming by 1-Script.com

Contact Us | Privacy Policy
The site map in XML format XML site map