Creating a custom default configuration


[NOTE: ]

NOTE: This feature is not supported on the HP 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: ]

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. An example is shown below.

Creating a config file with the desired features

HP Switch(config)# spanning-tree
HP Switch(config)# interface 4 flow-control

HP 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 below.

Copying the startup configuration file to the custom default configuration file

HP Switch(config)# copy startup-config default-config

Copying an existing configuration file to the custom default configuration file

The switch can have up to 3 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.) To copy a configuration file that exists in flash memory to the custom default configuration file, use this command.

Syntax

copy config <source-filename> default-config

Copies the configuration file specified in [<source-filename>] to the custom default configuration file.

Copying the abc.cfg config file to the custom default config file

HP Switch(config)# copy abc.cfg default-config

Copying the custom default config file onto the switch

The following sections explains how to copy the custom default config file onto the switch using:

  • TFTP

  • XMODEM

  • USB

Using TFTP

To copy a configuration file stored on a TFTP server to the custom default configuration file, use the copy tftp default-config command.

Syntax

copy tftp default-config <ip-addr> <stored config file name>

Copies the stored configuration file on the TFTP server specified by <ip-addr> to the custom default configuration file.

Copying a stored config file to the default config file using TFTP

HP Switch(config)# copy tftp default-config 10.10.10.1 stored_config.cfg

Using XMODEM

To copy a configuration file to the custom default configuration file using XMODEM, use the copy xmodem default-config command.

Syntax

copy xmodem default-config

Copies the configuration file specified by the XMODEM server device to the custom default configuration file.

Copying a stored config file to the custom default config file using XMODEM

HP Switch(config)# copy xmodem default-config

Using USB

To copy a configuration file to the custom default configuration file using USB, use the copy usb default-config command.

Syntax

copy usb default-config <stored config file name>

Copies the stored configuration file on the USB stick to the custom default configuration file.

Copying a stored config file to the custom default config file using USB

HP Switch# copy usb default-config stored_config.cfg

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

  • USB

Using TFTP

To transfer a custom default configuration file off the switch using TFTP, enter the following command.

Syntax

copy default-config tftp <server ip-address> stored_config.cfg

Copies the custom default configuration file to the stored_config.cfg file on the TFTP server.

Using XMODEM

To transfer a custom default config file off the switch using XMODEM, enter the following command.

Syntax

copy default-config xmodem

Copies the custom default configuration file to the configuration file specified by the XMODEM server device.

Using USB

To transfer a custom default configuration file off the switch using USB, enter the following command.

Syntax

copy default-config usb stored_config.cfg

Copies the custom default configuration file to the stored_config.cfg file on the USB device.

Using SFTP and SCP to transfer the custom configuration

While the switch supports an SSH server with SCP and/or SFTP running on it, the switch is not an SCP or SFTP client. 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 that can be accessed by the switch.


[NOTE: ]

NOTE: 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 runningpuTTY 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

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.

Erasing the startup config file when a default custom config file exists

HP 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]?

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.

Erasing the startup config file when a default custom config file does not exist

HP Switch(config)# erase startup-config
Configuration will be deleted, and existing login passwords removed,
and device rebooted, continue [y/n]?

To erase the custom default configuration file, execute the erase default-config command.

Erasing the custom default config file

HP Switch(config)# erase default-config
The custom default configuration will be erased. The "erase
startup-config" command will now use system generated default
configuration. Continue [y/n]?

Displaying the configuration files

Theshow config files command displays the existing configuration files and indicates that a custom default configuration file exists.

Output displaying 3 configuration files

HP Switch(config)# show config files

Configuration files:

id | act pri sec | name
---+-------------+--------------------------
 1    *   *      | config
 2               | secondaryconfig
 3            *  | Kconfig
==================
A Custom default configuration file exists.

Enter the command show default config to display the custom default configuration.


[NOTE: ]

NOTE: For the 5400zl, 3800, and 8200zl 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 chapter "Secure Mode (5400zl, 3800, and 8200zl)" in the Access Security Guide for your switch.


Output for custom default configuration file

HP Switch(config)# show default-config

Custom default configuration:

; J8693A Configuration Editor; Created on release #K.15.14.0001

; Ver #02:0b:ef:e6
hostname "HP 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

If a custom default configuration file exists and you erase the current active config file (using the erase startup-config command), then issue the show running-config command, the output will display the contents of the custom default configuration file. The custom default configuration file is loaded upon bootup.

Output of custom default config file when current active config file erased

HP Switch(config)# show running-config

Custom default configuration:

; J8693A Configuration Editor; Created on release #K.15.12.0001
; Ver #02:0b:ef:e6
hostname "HP 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.