Jochen Wiedmann > Cisco-Conf > cisconf

Download:
Cisco-Conf-0.10.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

cisconf - Cisco configuration management via TFTP

SYNOPSIS ^

    cisconf -a <conf>
    cisconf -d <conf>
    cisconf -e <conf> [-n]
    cisconf -r <conf>
    cisconf -l <conf>
    cisconf -s <conf> [-w]
    cisconf -i
    cisconf -h
    cisconf -v

DESCRIPTION ^

The cisconf utility allows to maintain a a set of Cisco router configurations as files. Configuration files can be loaded from routers or saved into routers by using a local TFTP server.

Adding router configurations

Usually you start with adding router configurations to the config file, ~etc_dir~/configuration. This is done by invoking

    cisconf -a <conf>

where <conf> is a short and unique name for the configuration you like to add.

The script will ask you some questions interactively and allow you to enter the new routers settings, in particular the IP address, the login username, the login and enable password, a description and a list of users that are allowed to manage the router.

Deleting router configurations

You can remove a given router configuration with

    cisconf -d <conf>

where <conf> is the name you gave the router when invoking cisconf -a <conf>.

Editing router configurations

Router configurations can be edited with

    cisconf -e <conf> [-n]

This will invoke the editor from the environment variable EDITOR. If you didn't set this variable, the first editor from the editors list in the configuration file ~etcdir~/configuration is used.

After you have modified the configuration, the revision control system will be invoked, unless you specify the option -n. Revision control will be done by using the command from the ci attribute in the configuration file.

Printing a router configuration

The command

    cisconf -p <conf>

will print the configuration file of the given router to stdout.

Loading a configuration file from the router

The best starting point for creating a new configuration is of course loading the current configuration of the router. This is done by invoking the command

    copy running-config tftp

on the router and storing the configuration on the local TFTP server. The command

    cisconf -l <conf>

will do that for you, creating the file ~tftp_dir~/<conf<gt.conf>.

Of course this requires an appropriately configured TFTP server with write permissions in the directory ~tftp_dir~.

Storing a configuration file on the router

The counterpart of the -l option is

    cisconf -s <conf> [-w]

This will read the file ~etcdir~/<conf<gt.conf>, strip comments and empty lines and store the result in ~etcdir~/<conf<gt.conf>. The latter file will then be stored on the router by executing the command

    copy tftp running-config

Note, that by default the new configuration is not written into the non-volatile memory of the router! The option -w modifies this behaviour by executing the command

    write memory

on the router, if the configuration has successfully be stored on the router.

Listing router configurations

The command

    cisconf -i

will print a list of all router configurations accessible by the current user.

Printing a help message

You get a short help message by invoking

    cisconf -h

Version number

The command

    cisconf -v

will print the programs version number and exit immediately.

AUTHOR AND COPYRIGHT ^

This program is

    Copyright (C) 1998    Jochen Wiedmann
                          Am Eisteich 9
                          72555 Metzingen
                          Germany

                          Phone: +49 7123 14887
                          Email: joe@ispsoft.de

All rights reserved.

You may distribute this module under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

SEE ALSO ^

Cisco::Conf(3), Cisco::Conf::Install(3), tftpd(8)

EOF

require Cisco::Conf; my $config = Cisco::Conf->_ReadConfigFile('configuration');

require Config; $config->{'startperl'} = $Config::Config{'startperl'};

$script =~ s/\~(\w+)\~/$config->{$1}/eg;

if (!open(FILE, ">cisconf") || !print FILE ($script) || !close(FILE)) { die "Error while writing cisconf script: $!"; }

syntax highlighting: