Problem solve Get help with specific problems with your technologies, process and projects.

Automating configurations

How to utilize spreadsheets to make configuration changes.

If you're working in an environment where you have lots of routers and switches with standardized configs, and you're looking for a good way to automate some of your tasks, consider building your device configs in your favorite spreadsheet application.

The trick here is to put each command in a row, as you want it listed in your config, and to put each keyword and parameter that you would want to change in a separate column. Then, you can either print it to a text file, or better yet, export it as a space-delimited text file.

Consider a scenario where you had a bunch of switches, and you always gave their management interface an IP address of .10 in whichever /24 bit subnet you assign. You could put some input fields at the top for the first 3 octets of the IP address. Then, in the appropriate row where you assign the ip address, your first cell could contain "ip address", and your second cell would be a formula like =string(cell with first octet) + "." + string(cell with second octet) + "." + string(cell with third octet) + "10". Your last cell would contain "". So when these are exported as text, they would read "ip address a.b.c.10".

Since you probably use the first three octets of that IP address several times in the config, and things like your passwords and snmp community strings over on each switch, this can save you a lot of typing. So you could just enter your data in the entry fields once, and then print them out to generate nearly identical configs.

Alternatively, you could get a little more sophisticated and create something akin to a mail merge utility, using macros, where you could press a button and generate all your configs.

Finally, if you name the configs correctly, and have your merge macro export them to a directory on a TFTP server, you can use the Cisco autoconfiguration feature to help you load them.

This also makes it very easy for you to make changes later on, as long as you have the discipline not to go tweaking each individual config.

And, this is especially handy when you're dealing with configs that have lots of access-lists, as the parameters there lend themselves to formulas.

Tom Lancaster, CCIE# 8829 CNX# 1105, is a consultant with 15 years experience in the networking industry, and co-author of several books on networking, most recently, CCSPTM: Secure PIX and Secure VPN Study Guide published by Sybex.

This was last published in November 2004

Dig Deeper on Network automation and intent-based networking

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.