Global Router Configuration Tool  (cisco_config_cmds_rcf)

Top  Previous  Next

Global Router Configuration Tool  (cisco_config_cmds_rcf)

This program is very similar to the cisco_config_cmds script above except it is designed to send a different set of configuration commands to each Cisco IOS device.  Do not use this script to send exec level commands (e.g., show commands).  The specific configuration commands, and the IOS devices these commands are sent to, are defined in a text file that you create.  The format of the text file is described below.  This file containing configuration commands MUST NOT include the commands needed to enter and exit configuration mode on the router.  The script will automatically handle that.  The commands are sent in sequential order from top to bottom of the file. 

 

 

Program Name: cisco_config_cmds_rcf

 

Script Argument

Description

-rcf <filename>

Short for Router and Command File.  File which contains a List of routers or IP Address along with a file name which contains the list of configuration commands to send to each router (REQUIRED)

-testmode

Test Mode. Build and display the commands that would have been sent to the devices but DO NOT actually connect to the devices and send the commands.  Useful for confirming command looping and variable substitutions are correct or for just double checking the commands that will be sent .  List of commands are

also written to the file $SCRIPT_HOME/<script_name>_sample_cmds.txt".

(OPTIONAL)

-wm

Saves configuration file to NVRAM after making the configuration changes.  This option performs a “write mememory” on the router.  (OPTIONAL)

-safe

Safe Mode.  If an error occurs while sending a configuration command to a router in the list, all subsequent commands to that router will not be sent.  The script will continue on to the next router on the list and continue sending commands.  (OPTIONAL)

-ssafe

SuperSafe Mode.  Abort Script if there is an error while sending any of the configuration commands to any of the routers. (OPTIONAL)

-ssh

Use Secure Shell when accessing routers.  Do NOT use with -pw option. (OPTIONAL)

-pw <filename>

Login/Password File.  (OPTIONAL)

-log <filename>

Save detailed trace file to a name other than the default file name.  (OPTIONAL)

-ulog

Unique Log file.  Save detailed trace log file to a Unique filename automatically created by script. Filename will be in format of scriptname_timestamp.log. (OPTIONAL)

 

 

 

Below shows and example of an rcf file.  This is not a TCL formatted file, it is just a text file.  Lines that begin with a # are comments.  The format of the file is rtrname:filename.  One entry per line.  The format for the file that contains the configuration commands for a particular router is identical to the “cisco_config_cmds” script. 

 

# Sample template file for cisco_config_cmds_rcf script
# Lines that begind with a # are comments
# Format of file is router:filename
# Where file name contains a list of configuration
# commands that will only be sent to that router
 
nyrtr1:nyrtr1.cmds
10.1.1.1:cmd_file1.cmds

Figure 2 Sample rcf file

 

# List of configuration commands to send
# to router: nyrtr1
 
interface Ethernet 1/0
 ip route-cache cef

Figure 3 Contents for file nyrtr1.cmds

 

# List of configuration commands to send
# to router: 10.1.l.1
 
interface Ethernet 1/2
 ip route-cache cef
interface Ethernet 1/3
 shutdown

Figure 4 Contents for file cmd_file1.cmds

 

By default, the configuration commands will not be saved to NVRAM.  Use the -wm option to save the configuration changes.

 

This program also has the option to be run in Safe and SuperSafe mode which should be considered when running scripts in production environments.  If entering a configuration command results in an error on the router and the script is running in Safe or SuperSafe mode, the config will not be saved to NVRAM even if the -wm option is applied.  If the script is NOT running in Safe or SuperSafe mode, and the -wm option is applied, the config WILL be saved to NVRAM even if there are one or more commands that caused configuration errors.

 

Sample Command: The following command will send configuration commands to the routers listed in file rtr_mod_100104.rcf.  The commands that are sent to each router may be different and are also defined by a filename listed in the file rtr_mod_100104.rcf.  After the configuration commands are entered, the config will be saved to NVRAM because of the -wm option.  If there are any errors while sending a particular configuration command, the script will abort the script because of the -ssafe option (SAFE Mode).  The detailed trace-log will be saved to the file cisco_config_cmds_rcf.log because the -log option is not being used. The script will not prompt the user for passwords because the passwords are being read in from the logins.txt file (-pw option).

 

cisco_config_cmds_rcf -pw logins.txt -rcf rtr_mod_100104.rcf -wm -ssafe