This section describes how to replace the configurations on multiple devices that share the same source to achieve configuration consistency between the devices.
In a scenario where a management server manages a device, the server stores the configurations required by the device. If the configurations on the management server change, the configurations on the device also need to be changed accordingly. In this case, you can load the configuration file on the management server and use this file to replace the configurations on the device, achieving configuration consistency between the management server and the device.
If one of the devices with the same configurations encounters a configuration change, the configurations of other devices must be changed accordingly to keep configuration consistency. In this case, you can load the configurations on the device with the configuration change to replace the configurations on the other devices. This ensures that the configurations on all the devices are the same.
The configuration replacement function can replace the entire configuration file on the current device or the configuration in a specific view, depending on the content in the source configuration file to be loaded. If the source configuration file contains the configurations of an entire device, this function replaces all configurations on the current device. If the source configuration file contains the configurations only in a specific view (the configurations saved in a view automatically carry the <replace/> tag), this function replaces the configurations in the corresponding view.
This function is supported only in the two-phase configuration validation mode.
To load the configuration file of a local device to replace the current running configurations, perform the following steps on the local device:
If a local configuration file is loaded to replace the current device configuration, the local configuration file must be stored in the root directory of the device. The save command saves a configuration file to the root directory by default.
If you run the command in a non-user view, the configuration-file parameter must be specified and the file name extension must be .zip or .cfg.
The system view is displayed.
Run the load configuration file filename replace [ relative ] command to load a local configuration file and use it to replace the configuration file in use.
The configuration file can contain only configuration commands, view switching commands, and pound signs (#). If you load other types of commands, such as display commands used for query, reset/save/ping commands used for maintenance, quit, commit, return, upgrade-compatible commands, and one-phase configuration validation commands, the device reports an error and continues to load follow-up commands.
The interactive commands in the configuration file support only Y/N automatic interaction.
The configuration file name extension must be .zip, .cfg, .txt, .dat, or .bat, or the file name does not have an extension. In FTP or SFTP mode, a file name can contain a server directory. A file name does not contain the following special characters: ~, ?, *, /, \, :, ", |, <, >, [, and ].
Check whether the post-replacement configurations meet the expectation.
The configuration is committed.