Sourcing a Configuration

Source a configuration to merge a script file into the running configuration or verify the syntax of a configuration file.

About this task

The source cli command is intended for use with a switch that is running with a factory default configuration to quick load a pre-existing configuration from a file. If you source a configuration file to merge that configuration into a running configuration, it can result in operational configuration loss if the sourced configuration file contains any configuration that has dependencies on or conflicts with the running configuration. Use the source command to merge smaller portions of a configuration into the existing configuration.

Not all CLI commands are included in configuration files. Typical examples include, but are not limited to some operational and security-related commands. Ensure that you understand what configuration options are included or not included in a configuration file, when you use that file to build new configurations.

The operational modes in the boot configuration file must be configured for some features (for example, spbm-config-mode true/false). Before sourcing a configuration file, you need to configure the boot config flag, save the configuration, and reboot the system. After the reboot, you can source the configuration file without fail.

Important

Important

Do not source a verbose configuration (verbose.cfg) with the debug stop option. The sourcing process cannot complete if you use these two options with a verbose configuration.

Procedure

  1. Enter Privileged EXEC mode:

    enable

  2. Source a configuration:

    source WORD<1–99> [debug] [stop] [syntax]

Example

Switch:1> enable

Debug the script output:

Switch:1# source testing.cfg debug

Variable Definitions

The following table defines parameters for the source command.

Variable

Value

debug

Debugs the script by outputting the configuration commands to the screen.

stop

Stops the sourcing of a configuration if an error occurs.

syntax

Checks the syntax of the configuration file. This parameter does not load the configuration file; only verifies the syntax.

If you use this parameter with the stop parameter (source WORD<1-99> stop syntax), the output displays on screen and verification stops if it encounters an error.

If you use this parameter with the debug parameter (source WORD<1-99> debug syntax), the output does not stop if it encounters an error; you must review the on-screen output to verify if an error exists.

If you use this parameter by itself, it does not output to the screen or stop on error; it shows an error message, syntax errors in script, to indicate if errors exist in the configuration file.

WORD<1–99>

Specifies a filename and location in one of the following format:

  • a.b.c.d:<file>

  • /intflash/<file>

<file> is a string.