Display and Save Configuration to Flash
The current configuration of the device can be displayed in the form of a virtual file containing the full set of commands necessary to create an identical configuration. A few exceptions exist because certain items are not displayed, such as private SSH keys. This file is called running-config and is volatile by nature; it does not survive across reboots. It is therefore necessary to save the file to flash storage under the name startup-config, as this file is read and executed upon every boot and is therefore responsible for restoring the running configuration of the system to the state it had when the save took place. The command show running-config will display the configuration settings as seen below. For brevity, some details were edited out. In addition, the set of interfaces is dependent on hardware capabilities.
Lines that begin with ‘!’ are comments. The file begins with the hostname command and the password for the admin user, followed by VLANs 1 and 42 and other items, such as Spanning Tree Protocol (STP). A list of all port interfaces on the device, ordered by switch ID, type, and port number comes next. All port interfaces are at default settings, so nothing is displayed for them. As a general rule, only nondefault configuration is displayed, otherwise the output would be huge and readability would suffer. There are a few exceptions that will be discussed later. Following the physical interfaces are VLAN interfaces 1 and 42. Only the former has an IP address assigned. Finally, the line section is shown. It specifies characteristics for the serial console (line console 0) or network ICLI management connections (line vty x). The configuration as displayed above is also what is saved to startup-config.
The dir command lists the files in the flash file system while more outputs the contents of the designated file. The skills exercised in this section form the basis for all day-to-day work with the ICLI on the device: logging in, displaying information with the show command, working with configuration files (show running-config, copy, dir, more), working with the actual configuration (configure terminal, exit), and sub-modes (interface ...). The configuration proceeds in the same manner as setting the hostname: Enter configuration mode, input and execute configuration commands, leave configuration mode. The following commands instruct the device to use DHCP to obtain an IP address, or, if DHCP fails, to use a static fallback address. Inclusion of a fallback IP is optional and may be omitted.
Last updated