Creating a custom default configuration
NOTE: This feature is not supported on the 3800 switches. | |
The custom default configuration feature provides the ability to initialize a switch to a different state from the factory default state when you delete the active configuration file. The factory default configuration is not changed. If a custom configuration file has been created and the active configuration file is deleted, the switch will boot up using the custom configuration file.
The feature provides the ability to:
Use a customized configuration file as a default configuration file
Enable the switch to start up with the specified default configuration
The existence of a custom default configuration file does not affect the results of loading a remotely stored configuration file onto the switch.
Using a custom default configuration, you can configure the features you want to be in the default configuration. When the active configuration is deleted using the erase startup command, the active configuration is removed and the custom default configuration file will be used upon bootup. The standard default configuration file remains and is used if there is no custom default configuration.
NOTE: This feature does not change the system defaults. The custom default configuration file is automatically used when the startup configuration file is erased. It has no effect on what is loaded onto the switch when a remotely stored configuration file is restored. | |
The default configuration file can be customized using commands at the CLI prompt or by copying a configuration file with the desired configuration using TFTP, USB, or XMODEM copy commands. The existing default configuration file also can be transferred from the switch using these commands.
To start creating the configuration file to be used as the custom default configuration file, enter the commands that configure the features desired and then save the configuration file using the write memory command. The following example is as shown.
Creating a config file with the desired features
switch(config)# spanning-tree switch(config)# interface 4 flow-control switch(config)# write memory
This configuration, which enables flow control on interface 4, and also spanning tree on the switch, is stored in the startup configuration file.
To save this configuration as the custom default configuration, the startup configuration file is copied to the default configuration file, as shown following.
Copying the startup configuration file to the custom default configuration file
switch(config)# copy startup-config default-config
Copying an existing configuration file to the custom default configuration file
Use the following command to copy a configuration file that exists in flash memory to the custom default configuration file:
copy config <source-filename> default-config
The switch can have up to three different configuration files stored in flash memory. (For more information about multiple configuration files, see "Multiple Configuration Files" in the Management and Configuration Guide for your switch.)
Copying the custom default config file onto the switch
The custom default config file can be copied onto the switch using TFTP, XMODEM, or USB.
TFTP—Use the copy tftp default-config command to copy a configuration file stored on a TFTP server to the custom default configuration file:
copy tftp default-config <ip-addr> <stored config file name>
XMODEM—Use the copy xmodem default-config command to copy a configuration file to the custom default configuration file using XMODEM:
copy xmodem default-config
USB—Use the copy usb default-config command to copy a configuration file to the custom default configuration file using USB:
copy usb default-config <stored config file name>
Copying the custom default config file off the switch
The following sections explains how to copy the custom default config file off the switch using TFTP, XMODEM, or USB.
-
TFTP—Enter the following command to copy the custom default configuration file to the stored_config.cfg file on the TFTP server.
copy default-config tftp <server ip-address> stored_config.cfg
-
XMODEM—Enter the following command to copy the custom default configuration file to the configuration file specified by the XMODEM server device.
copy default-config xmodem
-
USB—Enter the following command to copy a custom default configuration file from the switch to the stored_config.cfg file on the USB device.
copy default-config usb stored_config.cfg
Using SFTP and SCP to transfer the custom configuration
To transfer the default custom configuration file to or from the switch, you must connect to the switch’s SSH server using any SCP or SFTP client. Instead of the actual name of the custom default configuration file, an alias name of "default-config" is displayed in the file listings and for get/store functions.
When you use an SCP client to connect to the switch, you must know the name of the file you wish to get or store. When you use SFTP client to connect to the switch, you are provided with a list of filenames which are accessed by the switch.
NOTE: While the switch supports an SSH server with SCP and/or SFTP running on it, the switch is not an SCP or SFTP client. You must have an SCP/SFTP client implemented in order to execute copy scp or copy sftp commands on the switch. | |
The following example shows the output from running puTTY psftp on a remote PC.
Using SFTP
C:\PuTTY> psftp 10.1.243.209 We'd like to keep you up to date about: * Software feature updates * New product announcements * Special events Please register your product at: www.register.hp.com Remote working directory is / psftp> ls Listing directory / drwxr-xr-x 2 J9145A J9145A 0 Jan 01 00:01 cfg drwxr-xr-x 2 J9145A J9145A 0 Jan 01 00:01 core drwxr-xr-x 2 J9145A J9145A 0 Jan 01 00:01 log drwxrwxrwx 2 J9145A J9145A 0 Jan 01 00:01 os drwxrwxrwx 3 J9145A J9145A 0 Jan 01 00:01 ssh psftp> ls /cfg Listing directory /cfg -rwxrw-r-- 1 J9145A J9145A 1749 Jan 01 00:01 default-config -rw-r--r-- 1 J9145A J9145A 745 Jan 01 01:19 running-config -rwxrw-r-- 1 J9145A J9145A 360 Jan 01 01:19 startup-config psftp>
Erasing a configuration file
To erase a configuration file:
Use the erase startup-config command to erase the startup configuration file.
If a custom default configuration file exists and the erase startup-config command is executed, the current active configuration is erased and the switch is booted with the custom default configuration. If a custom default configuration file does not exist and the erase startup-config command is executed, the current active configuration is erased and the switch is booted with the system default configuration.
Use the erase default-config command to erase the custom default configuration file.
Erasing the startup config file when a default custom config file exists
switch(config)# erase startup-config Configuration will be deleted, and existing login passwords removed, and device rebooted (using the custom default configuration), continue [y/n]?
Displaying the configuration files
To display configuration files:
Use the show config files command to display the existing configuration files. This command also indicates whether a custom default configuration file exists.
Use either the command show default config or the command show running-config to display the custom default configuration.
If a custom default configuration file exists and you erase the current active config file (using the erase startup-config command), use the show running-config command to display the custom default configuration, which is loaded upon bootup.
NOTE: For the 5400zl and 3800 switches, when the show default config command is executed in enhanced secure mode the following prompt displays:
Do you want to show sensitive information (y/n)?
If "Y/y" is entered, the normal command output is displayed on the console. If "N/n" is entered, all the sensitive information is hidden and will be displayed as asterisks ("*****"). The default option is "N/n" when interactive mode is disabled. For more information, see the "Secure Mode (5400zl and 3800)" in the Access Security Guide for your switch.
Output displaying three configuration files
switch(config)# show config files Configuration files: id | act pri sec | name ---+-------------+-------------------------- 1 * * | config 2 | secondaryconfig 3 * | Kconfig ================== A Custom default configuration file exists.
Output for custom default configuration file
switch(config)# show default-config Custom default configuration: ; J8693A Configuration Editor; Created on release #K.15.14.0001 ; Ver #02:0b:ef:e6 hostname "switch" module 1 type J93x7 module 2 type J93x7 vlan 1 name "DEFAULT-VLAN" untagged 1-24 ip address dhcp-bootp exit interface 4 flow-control exit snmp-server community "public" unrestricted spanning-tree
Output of custom default config file when current active config file erased
switch(config)# show running-config Custom default configuration: ; J8693A Configuration Editor; Created on release #K.15.12.0001 ; Ver #02:0b:ef:e6 hostname "switch" module 1 type J93x7 module 2 type J93x7 vlan 1 name "DEFAULT-VLAN" untagged 1-24 ip address dhcp-bootp exit interface 4 flow-control exit snmp-server community "public" unrestricted spanning-tree
Troubleshooting custom default configuration files
If the switch will not boot because of a problem with the custom default configuration file, the file can be removed using the ROM mode interface.
The custom default configuration file cannot be erased using the front panel buttons on the switch. If the switch can be booted, use the erase default-config command to remove the custom default configuration file.