[c-nsp] Config sync utility

Pierfrancesco Caci pf at caci.it
Thu May 19 17:54:26 EDT 2011


>>>>> "Stig" == Stig Meireles Johansen <stig.johansen at datametrix.no> writes:


    Stig> Jason Lixfeld wrote:
    >> For example, if I want to synchronize the logging and ntp configs
    >> on 30 IOS devices (for simplicity, we'll say that all these
    >> devieces are the same and running the same train of code being,
    >> at most, only one, maybe two maintenance versions apart from one
    >> another) against a master logging and ntp config block.  I've got
    >> all the configs backed up regularly via RANCID, but all RANCID
    >> does is provide a diff.  It doesn't have the intelligence to spit
    >> out an output that includes, for example, no logging host 1.1.1.1
    >> before adding logging host 2.2.2.2.

    Stig> RANCID is enough :)

    Stig> A quick expect hack;

    Stig> Put the following into a file (f.ex. your-script-file.tcl)
    Stig> expect "#" send "conf term\n" expect "(config)#" send "no
    Stig> logging host 1.1.1.1\n" expect "(config)#" send "logging host
    Stig> 2.2.2.2\n" expect "(config)#" send "ntp server 2.2.2.2\n"
    Stig> expect "(config)#" send "end\n" expect "#" send "copy
    Stig> running-config startup-config\n" expect "#"

    Stig> And run it on your hosts like;

    Stig> clogin -s your-script-file.tcl 10.0.0.1 10.0.0.2 10.0.0.3
    Stig> 10.0.0.4 etc. etc.

    Stig> You can put all the "intelligence" you want into the script,
    Stig> checking for something and acting upon it or not.


Or maybe just do:

$cat > configsnippet
conf t
no logging host 1.1.1.1
logging host 2.2.2.2
exit
wr

ctrl-d

$clogin -x configsnippet router1 router2 etc...

If you need the config statements to be done atomically, e.g. for an
access list:

$cat > do-update
conf t
file prompt quiet
exit
copy ftp://somehost/somedir/somefile running-config
conf t
default file prompt
exit
wr

ctrl-d

and then again 

$clogin -x do-update router1 router2...

And also look at snmp commands to execute file loads. They are there,
I've never used them. 

-- 
Pierfrancesco Caci


More information about the cisco-nsp mailing list