Assign the Switch Module IP Address and Default Gateway

This chapter describes how to create the initial switch module configuration (for example, assigning the switch module module IP address and default gateway information) for the CGR 2010 ESM by using a variety of automatic and manual methods. It also describes how to modify the switch module startup configuration.


Note For complete syntax and usage information for the commands used in this chapter, see the command reference for this release and to the Cisco IOS Software Documentation, 12.2 Mainline Release, Command References, Volume 1 of 3: Addressing and Services.


This chapter contains the following topics:


Note Information in this chapter about configuring IP addresses and DHCP is specific to IP Version 4 (IPv4).


Understanding the Boot Process

To start your switch module, follow the procedures in the Cisco Connected Grid 10-Port Ethernet Switch Module Interface Card Getting Started Guide about installing and powering on the switch module, accessing the switch module from the host Cisco CGR 2010 router, and setting up the initial configuration (IP address, subnet mask, default gateway, secret and Telnet passwords, and so forth) of the switch module.

The normal boot process involves the operation of the boot loader software, which performs these functions:

  • Performs low-level CPU initialization. It initializes the CPU registers, which control where physical memory is mapped, its quantity, its speed, and so on
  • Performs power-on self-test (POST) for the CPU subsystem. It tests the CPU DRAM and the portion of the flash device that makes up the flash file system
  • Initializes the flash file system on the system board
  • Loads a default operating system software image into memory and boots the switch module

The boot loader provides access to the flash file system before the operating system is loaded. Normally, the boot loader is used only to load, uncompress, and launch the operating system. After the boot loader gives the operating system control of the CPU, the boot loader is not active until the next system reset or power-on.

The switch module has a 64 MB bootflash that can store two Cisco IOS software image and the configuration files.

Use the show flash: privileged EXEC command to display the boot flash file settings.

The boot loader also provides trap-door access into the system if the operating system has problems serious enough that it cannot be used. The trap-door mechanism provides enough access to the system so that if it is necessary, you can format the flash file system, reinstall the operating system software image by using the XMODEM Protocol, recover from a lost or forgotten password, and finally restart the operating system. For more information, see the “Recovering from a Software Failure” section and “Recovering from a Lost or Forgotten Password” section.

Before you can assign switch module information, make sure you have connected a PC or terminal to the Cisco CGR 2010 router’s console port, and configured the PC or terminal-emulation software baud rate and character format to match these of the router console port:

  • Baud rate default is 9600
  • Data bits default is 8

Note If the data bits option is set to 8, set the parity option to none.


  • Stop bits default is 1
  • Parity settings default is none

Assigning Switch Module Information

You can assign IP information through the switch module setup program, through a DHCP server, or manually.

Use the switch module setup program if you want to be prompted for specific IP information. With this program, you can also configure a hostname and an enable secret password. It gives you the option of assigning a Telnet password (to provide security during remote management). For more information about the setup program, see the Appendix A, “Initial Configuration with the CLI Setup Program.”

Use a DHCP server for centralized control and automatic assignment of IP information after the server is configured.


Note If you are using DHCP, do not respond to any of the questions in the setup program until the switch module receives the dynamically assigned IP address and reads the configuration file.


If you are an experienced user familiar with the switch module configuration steps, manually configure the switch module. Otherwise, use the setup program described previously.

These sections contain this configuration information:

Default Switch Module Information

Table 4-1 shows the default switch module information.

 

Table 4-1 Default Switch Module Information

Feature
Default Setting

IP address and subnet mask

No IP address or subnet mask are defined

Default gateway

No default gateway is defined

Enable secret password

No password is defined

Hostname

The factory-assigned default hostname is Switch

Telnet password

No password is defined

Understanding DHCP-Based Autoconfiguration

DHCP provides configuration information to Internet hosts and internetworking devices. This protocol consists of two components: one for delivering configuration parameters from a DHCP server to a device and a mechanism for allocating network addresses to devices. DHCP is built on a client-server model, in which designated DHCP servers allocate network addresses and deliver configuration parameters to dynamically configured devices. The switch module can act as both a DHCP client and a DHCP server.

During DHCP-based autoconfiguration, your switch module (DHCP client) is automatically configured at startup with IP address information and a configuration file.

With DHCP-based autoconfiguration, no DHCP client-side configuration is needed on your switch module. However, you need to configure the DHCP server for various lease options associated with IP addresses. If you are using DHCP to relay the configuration file location on the network, you might also need to configure a Trivial File Transfer Protocol (TFTP) server and a Domain Name System (DNS) server.

The DHCP server for your switch module can be on the same LAN or on a different LAN than the switch module. If the DHCP server is running on a different LAN, you should configure a DHCP relay device between your switch module and the DHCP server. A relay device forwards broadcast traffic between two directly connected LANs. A router does not forward broadcast packets, but it forwards packets based on the destination IP address in the received packet.

DHCP-based autoconfiguration replaces the BOOTP client functionality on your switch module.

DHCP Client Request Process

When you boot your switch module, the DHCP client is invoked and requests configuration information from a DHCP server when the configuration file is not present on the switch module. If the configuration file is present and the configuration includes the ip address dhcp interface configuration command on specific routed interfaces, the DHCP client is invoked and requests the IP address information for those interfaces.

Figure 4-1 shows the sequence of messages that are exchanged between the DHCP client and the DHCP server.

Figure 4-1 DHCP Client and Server Message Exchange

 

 

The client, Switch A, broadcasts a DHCPDISCOVER message to locate a DHCP server. The DHCP server offers configuration parameters (such as an IP address, subnet mask, gateway IP address, DNS IP address, a lease for the IP address, and so forth) to the client in a DHCPOFFER unicast message.

In a DHCPREQUEST broadcast message, the client returns a formal request for the offered configuration information to the DHCP server. The formal request is broadcast so that all other DHCP servers that received the DHCPDISCOVER broadcast message from the client can reclaim the IP addresses that they offered to the client.

The DHCP server confirms that the IP address has been allocated to the client by returning a DHCPACK unicast message to the client. With this message, the client and server are bound, and the client uses configuration information received from the server. The amount of information the switch module receives depends on how you configure the DHCP server. For more information, see the “Configuring the TFTP Server” section.

If the configuration parameters sent to the client in the DHCPOFFER unicast message are invalid (a configuration error exists), the client returns a DHCPDECLINE broadcast message to the DHCP server.

The DHCP server sends the client a DHCPNAK denial broadcast message, which means that the offered configuration parameters have not been assigned, that an error has occurred during the negotiation of the parameters, or that the client has been slow in responding to the DHCPOFFER message (the DHCP server assigned the parameters to another client).

A DHCP client might receive offers from multiple DHCP or BOOTP servers and can accept any of the offers; however, the client usually accepts the first offer it receives. The offer from the DHCP server is not a guarantee that the IP address is allocated to the client; however, the server usually reserves the address until the client has had a chance to formally request the address. If the switch module accepts replies from a BOOTP server and configures itself, the switch module broadcasts, instead of unicasts, TFTP requests to obtain the switch module configuration file.

The DHCP hostname option allows a group of switches to obtain hostnames and a standard configuration from the central management DHCP server. A client (switch module) includes in its DCHPDISCOVER message an option 12 field used to request a hostname and other configuration parameters from the DHCP server. The configuration files on all clients are identical except for their DHCP-obtained hostnames.

If a client has a default hostname (the hostname name global configuration command is not configured or the no hostname global configuration command is entered to remove the hostname), the DHCP hostname option is not included in the packet when you enter the ip address dhcp interface configuration command. In this case, if the client receives the DCHP hostname option from the DHCP interaction while acquiring an IP address for an interface, the client accepts the DHCP hostname option and sets the flag to show that the system now has a hostname configured.

Understanding DHCP-based Autoconfiguration and Image Update

You can use the DHCP image upgrade features to configure a DHCP server to download both a new image and a new configuration file to one or more switches in a network. This helps ensure that each new switch module added to a network receives the same image and configuration.

There are two types of DHCP image upgrades: DHCP autoconfiguration and DHCP auto-image update.

DHCP Autoconfiguration

DHCP autoconfiguration downloads a configuration file to one or more switches in your network from a DHCP server. The downloaded configuration file becomes the running configuration of the switch module. It does not over write the bootup configuration saved in the flash, until you reload the switch module.

DHCP Auto-Image Update

You can use DHCP auto-image upgrade with DHCP autoconfiguration to download both a configuration and a new image to one or more switches in your network. The switch module (or switches) downloading the new configuration and the new image can be blank (or only have a default factory configuration loaded).

If the new configuration is downloaded to a switch module that already has a configuration, the downloaded configuration is appended to the configuration file stored on the switch module. (Any existing configuration is not overwritten by the downloaded one.)


Note To enable a DHCP auto-image update on the switch module, the TFTP server where the image and configuration files are located must be configured with the correct option 67 (the configuration filename), option 66 (the DHCP server hostname) option 150 (the TFTP server address), and option 125 (description of the file) settings.

For procedures to configure the switch module as a DHCP server, see the and the “Configuring DHCP” section of the “IP addressing and Services” section of the Cisco IOS IP Configuration Guide, Release 12.2.


After you install the switch module in your network, the auto-image update feature starts. The downloaded configuration file is saved in the running configuration of the switch module, and the new image is downloaded and installed on the switch module. When you reboot the switch module, the configuration is stored in the saved configuration on the switch module.

Limitations and Restrictions

These are the limitations:

  • The DHCP-based autoconfiguration with a saved configuration process stops if there is not at least one Layer 3 interface in an up state without an assigned IP address in the network.
  • Unless you configure a timeout, the DHCP-based autoconfiguration with a saved configuration feature tries indefinitely to download an IP address
  • The auto-install process stops if a configuration file cannot be downloaded or if the configuration file is corrupted

Note The configuration file that is downloaded from TFTP is merged with the existing configuration in the running configuration but is not saved in the NVRAM unless you enter the write memory or copy running-configuration startup-configuration privileged EXEC command. Note that if the downloaded configuration is saved to the startup configuration, the feature is not triggered during subsequent system restarts.


Configuring DHCP-Based Autoconfiguration

These sections contain this configuration information:

If your DHCP server is a Cisco device, see the “Configuring DHCP” section of the “IP Addressing and Services” section of the Cisco IOS IP Configuration Guide, Release 12.2 for additional information about configuring DHCP.

DHCP Server Configuration Guidelines

Follow these guidelines if you are configuring a device as a DHCP server:

You should configure the DHCP server with reserved leases that are bound to each switch module by the switch module hardware address.

If you want the switch module to receive IP address information, you must configure the DHCP server with these lease options:

  • IP address of the client (required)
  • Subnet mask of the client (required)
  • DNS server IP address (optional)
  • Router IP address (default gateway address to be used by the switch module) (required)

If you want the switch module to receive the configuration file from a TFTP server, you must configure the DHCP server with these lease options:

  • TFTP server name (required)
  • Boot filename (the name of the configuration file that the client needs) (recommended)
  • Hostname (optional)

Depending on the settings of the DHCP server, the switch module can receive IP address information, the configuration file, or both.

If you do not configure the DHCP server with the lease options described previously, it replies to client requests with only those parameters that are configured. If the IP address and the subnet mask are not in the reply, the switch module is not configured. If the router IP address or the TFTP server name are not found, the switch module might send broadcast, instead of unicast, TFTP requests. Unavailability of other lease options does not affect autoconfiguration.

The switch module can act as a DHCP server. By default, the Cisco IOS DHCP server and relay agent features are enabled on your switch module but are not configured. These features are not operational. If your DHCP server is a Cisco device, for additional information about configuring DHCP, see the “Configuring DHCP” section of the “IP Addressing and Services” section of the Cisco IOS IP Configuration Guide from the Cisco.com page under Documentation > Cisco IOS Software > 12.2 Mainline > Configuration Guides.

Configuring the TFTP Server

Based on the DHCP server configuration, the switch module attempts to download one or more configuration files from the TFTP server. If you configured the DHCP server to respond to the switch module with all the options required for IP connectivity to the TFTP server, and if you configured the DHCP server with a TFTP server name, address, and configuration filename, the switch module attempts to download the specified configuration file from the specified TFTP server.

If you did not specify the configuration filename, the TFTP server, or if the configuration file could not be downloaded, the switch module attempts to download a configuration file by using various combinations of filenames and TFTP server addresses. The files include the specified configuration filename (if any) and these files: network-config, cisconet.cfg, hostname.config, or hostname.cfg, where hostname is the switch module’s current hostname. The TFTP server addresses used include the specified TFTP server address (if any) and the broadcast address (255.255.255.255).

For the switch module to successfully download a configuration file, the TFTP server must contain one or more configuration files in its base directory. The files can include these files:

  • Configuration file named in the DHCP reply (the actual switch module configuration file)
  • Network-confg or the cisconet.cfg file (known as the default configuration files)
  • Router-confg or the ciscortr.cfg file (these files contain commands common to all switches; normally, if the DHCP and TFTP servers are properly configured, these files are not accessed)

If you specify the TFTP server name in the DHCP server-lease database, you must also configure the TFTP server name-to-IP-address mapping in the DNS-server database.

If the TFTP server to be used is on a different LAN from the switch module, or if it is to be accessed by the switch module through the broadcast address (which occurs if the DHCP server response does not contain all the required information described previously), a relay must be configured to forward the TFTP packets to the TFTP server. For more information, see the “Configuring the Relay Device” section. The preferred solution is to configure the DHCP server with all the required information.

Configuring the DNS

The DHCP server uses the DNS server to resolve the TFTP server name to an IP address. You must configure the TFTP server name-to-IP address map on the DNS server. The TFTP server contains the configuration files for the switch module.

You can configure the IP addresses of the DNS servers in the lease database of the DHCP server from where the DHCP replies will retrieve them. You can enter up to two DNS server IP addresses in the lease database.

The DNS server can be on the same or on a different LAN as the switch module. If it is on a different LAN, the switch module must be able to access it through a router.

Configuring the Relay Device

You must configure a relay device, also referred to as a relay agent, when a switch module sends broadcast packets that require a response from a host on a different LAN. Examples of broadcast packets that the switch module might send are DHCP, DNS, and in some cases, TFTP packets. You must configure this relay device to forward received broadcast packets on an interface to the destination host.

If the relay device is a Cisco router, enable IP routing (ip routing global configuration command), and configure helper addresses by using the ip helper-address interface configuration command.

For example, in Figure 4-2, configure the router interfaces as follows:

On interface 10.0.0.2:

 

router(config-if)# ip helper-address 20.0.0.2
router(config-if)# ip helper-address 20.0.0.3
router(config-if)# ip helper-address 20.0.0.4

 

On interface 20.0.0.1:

 

router(config-if)# ip helper-address 10.0.0.1

 

Figure 4-2 Relay Device Used in Autoconfiguration

 

 

Obtaining Configuration Files

Depending on the availability of the IP address and the configuration filename in the DHCP reserved lease, the switch module obtains its configuration information in these ways:

  • The IP address and the configuration filename is reserved for the switch module and provided in the DHCP reply (one-file read method).

The switch module receives its IP address, subnet mask, TFTP server address, and the configuration filename from the DHCP server. the switch module sends a unicast message to the TFTP server to retrieve the named configuration file from the base directory of the server and upon receipt, it completes its boot-up process.

  • The IP address and the configuration filename is reserved for the switch module, but the TFTP server address is not provided in the DHCP reply (one-file read method).

The switch module receives its IP address, subnet mask, and the configuration filename from the DHCP server. The switch module sends a broadcast message to a TFTP server to retrieve the named configuration file from the base directory of the server, and upon receipt, it completes its boot-up process.

  • Only the IP address is reserved for the switch module and provided in the DHCP reply. The configuration filename is not provided (two-file read method).

The switch module receives its IP address, subnet mask, and the TFTP server address from the DHCP server. The switch module sends a unicast message to the TFTP server to retrieve the network-confg or cisconet.cfg default configuration file. (If the network-confg file cannot be read, the switch module reads the cisconet.cfg file.)

The default configuration file contains the hostnames-to-IP-address mapping for the switch module. The switch module fills its host table with the information in the file and obtains its hostname. If the hostname is not found in the file, the switch module uses the hostname in the DHCP reply. If the hostname is not specified in the DHCP reply, the switch module uses the default Switch as its hostname.

After obtaining its hostname from the default configuration file or the DHCP reply, the switch module reads the configuration file that has the same name as its hostname ( hostname -confg or hostname.cfg, depending on whether network-confg or cisconet.cfg was read earlier) from the TFTP server. If the cisconet.cfg file is read, the filename of the host is truncated to eight characters.

If the switch module cannot read the network-confg, cisconet.cfg, or the hostname file, it reads the router-confg file. If the switch module cannot read the router-confg file, it reads the ciscortr.cfg file.


Note The switch module broadcasts TFTP server requests if the TFTP server is not obtained from the DHCP replies, if all attempts to read the configuration file through unicast transmissions fail, or if the TFTP server name cannot be resolved to an IP address.


Example Configuration

Figure 4-3 shows a sample network for retrieving IP information by using DHCP-based autoconfiguration.

Figure 4-3 DHCP-Based Auto-Configuration Network Example

 

 

Table 4-2 shows the configuration of the reserved leases on the DHCP server.

 

Table 4-2 DHCP Server Configuration

Switch A
Switch B
Switch C
Switch D

Binding key (hardware address)

00e0.9f1e.2001

00e0.9f1e.2002

00e0.9f1e.2003

00e0.9f1e.2004

IP address

10.0.0.21

10.0.0.22

10.0.0.23

10.0.0.24

Subnet mask

255.255.255.0

255.255.255.0

255.255.255.0

255.255.255.0

Router address

10.0.0.10

10.0.0.10

10.0.0.10

10.0.0.10

DNS server address

10.0.0.2

10.0.0.2

10.0.0.2

10.0.0.2

TFTP server name

tftpserver or 10.0.0.3

tftpserver or 10.0.0.3

tftpserver or 10.0.0.3

tftpserver or 10.0.0.3

Boot filename (configuration file) (optional)

switcha-confg

switchb-confg

switchc-confg

switchd-confg

Hostname (optional)

switcha

switchb

switchc

switchd

 

DNS Server Configuration

The DNS server maps the TFTP server name tftpserver to IP address 10.0.0.3.

TFTP Server Configuration (on UNIX)

The TFTP server base directory is set to /tftpserver/work/. This directory contains the network-confg file used in the two-file read method. This file contains the hostname to be assigned to the switch module based on its IP address. The base directory also contains a configuration file for each switch module ( switcha-confg, switchb-confg, and so forth) as shown in this display:

 

prompt> cd /tftpserver/work/
prompt> ls
network-confg
switcha-confg
switchb-confg
switchc-confg
switchd-confg
prompt> cat network-confg
ip host switcha 10.0.0.21
ip host switchb 10.0.0.22
ip host switchc 10.0.0.23
ip host switchd 10.0.0.24

 

DHCP Client Configuration

No configuration file is present on Switch A through Switch D.

Configuration Explanation

In Figure 4-3, Switch A reads its configuration file as follows:

  • It obtains its IP address 10.0.0.21 from the DHCP server
  • If no configuration filename is given in the DHCP server reply, Switch A reads the network-confg file from the base directory of the TFTP server
  • It adds the contents of the network-confg file to its host table
  • It reads its host table by indexing its IP address 10.0.0.21 to its hostname (switcha)
  • It reads the configuration file that corresponds to its hostname; for example, it reads switch1-confg from the TFTP server

Switches B through D retrieve their configuration files and IP addresses in the same way.

Configuring the DHCP Auto Configuration and Image Update Features

Using DHCP to download a new image and a new configuration to a switch module requires that you configure at least two switches: One switch module acts as a DHCP and TFTP server. The client switch module is configured to download either a new configuration file or a new configuration file and a new image file.

Configuring DHCP Autoconfiguration (Only Configuration File)

Beginning in privileged EXEC mode, follow these steps to configure DHCP autoconfiguration of the TFTP and DHCP settings on a new switch module to download a new configuration file.

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Create a name for the DHCP Server address pool, and enter DHCP pool configuration mode.

ip dhcp poolname

Step 3

Specify the name of the configuration file that is used as a boot image.

bootfile filename

Step 4

Specify the subnet network number and mask of the DHCP address pool.

Note The prefix length specifies the number of bits that comprise the address prefix. The prefix is an alternative way of specifying the network mask of the client. The prefix length must be preceded by a forward slash (/).

network network-number mask prefix-length

Step 5

Specify the IP address of the default router for a DHCP client.

default-router address

Step 6

Specify the IP address of the TFTP server.

option 150 address

Step 7

Return to global configuration mode.

exit

Step 8

Specify the configuration file on the TFTP server.

tftp-server flash :filename.text

Step 9

Specify the address of the client that will receive the configuration file.

interface interface-id

Step 10

Put the interface into Layer 3 mode.

no switchport

Step 11

Specify the IP address and mask for the interface.

ip address address mask

Step 12

Return to privileged EXEC mode.

end

Step 13

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

This example shows how to configure a switch module as a DHCP server so that it will download a configuration file:

 

Switch# configure terminal
Switch(config)# ip dhcp pool pool1
Switch(dhcp-config)# network 10.10.10.0 255.255.255.0
Switch(dhcp-config)# bootfile config-boot.text
Switch(dhcp-config)# default-router 10.10.10.1
Switch(dhcp-config)# option 150 10.10.10.1
Switch(dhcp-config)# exit
Switch(config)# tftp-server flash:config-boot.text
Switch(config)# interface gigabitethernet0/4
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.10.1 255.255.255.0
Switch(config-if)# end

 

Configuring DHCP Auto-Image Update (Configuration File and Image)

Beginning in privileged EXEC mode, follow these steps to configure DHCP autoconfiguration to configure TFTP and DHCP settings on a new switch module to download a new image and a new configuration file.


Note Before following the steps in this table, you must create a text file (for example, autoinstall_dhcp) that will be uploaded to the switch module. In the text file, put the name of the image that you want to download. This image must be a tar and not a bin file.


 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Create a name for the DHCP server address pool and enter DHCP pool configuration mode.

ip dhcp pool name

Step 3

Specify the name of the file that is used as a boot image.

bootfile filename

Step 4

Specify the subnet network number and mask of the DHCP address pool.

Note The prefix length specifies the number of bits that comprise the address prefix. The prefix is an alternative way of specifying the network mask of the client. The prefix length must be preceded by a forward slash (/).

network network-number mask prefix-length

Step 5

Specify the IP address of the default router for a DHCP client.

default-router address

Step 6

Specify the IP address of the TFTP server.

option 150 address

Step 7

Specify the path to the text file that describes the path to the image file.

option 125 hex

Step 8

Upload the text file to the switch module.

copy tftp flash filename.txt

Step 9

Upload the tar file for the new image to the switch module.

copy tftp flash imagename.tar

Step 10

Return to global configuration mode.

exit

Step 11

Specify the Cisco IOS configuration file on the TFTP server.

tftp-server flash:config.text

Step 12

Specify the image name on the TFTP server.

tftp-server flash:imagename.tar

Step 13

Specify the text file that contains the name of the image file to download

tftp-server flash:filename.txt

Step 14

Specify the address of the client that will receive the configuration file.

interface interface-id

Step 15

Put the interface into Layer 3 mode.

no switchport

Step 16

Specify the IP address and mask for the interface.

ip address address mask

Step 17

Return to privileged EXEC mode.

end

Step 18

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

This example shows how to configure a switch module as a DHCP server so it downloads a configuration file:

 

Switch# config terminal
Switch(config)# ip dhcp pool pool1
Switch(dhcp-config)# network 10.10.10.0 255.255.255.0
Switch(dhcp-config)# bootfile config-boot.text
Switch(dhcp-config)# default-router 10.10.10.1
Switch(dhcp-config)# option 150 10.10.10.1
Switch(dhcp-config)# option 125 hex
0000.0009.0a05.08661.7574.6f69.6e73.7461.6c6c.5f64.686370
Switch(dhcp-config)# exit
Switch(config)# tftp-server flash:config-boot.text
Switch(config)# tftp-server flash:-image-name-mz.122-44.3.SE.tar
Switch(config)# tftp-server flash:boot-config.text
Switch(config)# tftp-server flash: autoinstall_dhcp
Switch(config)# interface gigabitEthernet1/0/4
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.10.1 255.255.255.0
Switch(config-if)# end

 

Configuring the Client

Beginning in privileged EXEC mode, follow these steps to configure a switch module to download a configuration file and new image from a DHCP server:

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Enable autoconfiguration with a saved configuration.

boot host dhcp

Step 3

(Optional) Set the amount of time the system tries to download a configuration file.

Note If you do not set a timeout the system will indefinitely try to obtain an IP address from the DHCP server.

boot host retry timeout timeout-value

Step 4

(Optional) Create warning messages to be displayed when you try to save the configuration file to NVRAM.

banner config-save ^C warning-message ^C

Step 5

Return to privileged EXEC mode.

end

Step 6

Verify the configuration.

show boot

 

This example uses a Layer 3 SVI interface on VLAN 99 to enable DHCP-based autoconfiguration with a saved configuration:

 

Switch# configure terminal
Switch(conf)# boot host dhcp
Switch(conf)# boot host retry timeout 300
Switch(conf)# banner config-save ^C Caution - Saving Configuration File to NVRAM May Cause
You to Nolonger Automatically Download Configuration Files at Reboot^C
Switch(config)# vlan 99
Switch(config-vlan)# interface vlan 99
Switch(config-if)# no shutdown
Switch(config-if)# end
Switch# show boot
BOOT path-list:
Config file: flash:/config.text
Private Config file: flash:/private-config.text
Enable Break: no
Manual Boot: no
HELPER path-list:
NVRAM/Config file
buffer size: 32768
Timeout for Config
Download: 300 seconds
Config Download
via DHCP: enabled (next boot: enabled)
Switch#

 


Note You should only configure and enable the Layer 3 interface. Do not assign an IP address or DHCP-based autoconfiguration with a saved configuration.


Manually Assigning IP Information

Beginning in privileged EXEC mode, follow these steps to manually assign IP information to a switch module virtual interface (SVI).

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Enter interface configuration mode, and enter the VLAN to which the IP information is assigned. The range is 1 to 4094; do not enter leading zeros.

interface vlan vlan-id

Step 3

Enter the IP address and subnet mask.

ip address ip-address subnet-mask

Step 4

Return to global configuration mode.

exit

Step 5

Enter the IP address of the next-hop router interface that is directly connected to the switch module where a default gateway is being configured. The default gateway receives IP packets with unresolved destination IP addresses from the switch module.

Once the default gateway is configured, the switch module has connectivity to the remote networks with which a host needs to communicate.

Note When your switch module is configured to route with IP, it does not need to have a default gateway set.

ip default-gateway ip-address

Step 6

Return to privileged EXEC mode.

end

Step 7

Verify the configured IP address.

show interfaces vlan vlan-id

Step 8

Verify the configured default gateway.

show ip redirects

Step 9

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

To remove the switch module IP address, use the no ip address interface configuration command. If you are removing the address through a Telnet session, your connection to the switch module will be lost. To remove the default gateway address, use the no ip default-gateway global configuration command.

For information on setting the switch module system name, protecting access to privileged EXEC commands, and setting time and calendar services, see Chapter6, “Administer the Switch Module”

Checking and Saving the Running Configuration

You can check the configuration settings you entered or changes you made by entering this privileged EXEC command:

 

Switch# show running-configuration
Building configuration...
 
Current configuration : 2010 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname switch
!
enable password cisco
!
no aaa new-model
ip subnet-zero
no ip domain-lookup
!
table-map test
default copy
!
no file verify auto
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
vlan 2,10
!
class-map match-all test1
class-map match-all class2
class-map match-all class1
!
!
policy-map test
class class1
police cir percent 30
policy-map test2
class class2
police cir 8500 bc 1500
policy-map test3
!
!
interface FastEthernet0/1
!
interface FastEthernet0/2
shutdown
!
interface FastEthernet0/3
shutdown
!
interface FastEthernet0/4
shutdown
!
interface FastEthernet0/5
shutdown
!
interface FastEthernet0/6
shutdown
!
interface FastEthernet0/7
shutdown
 
<output truncated>
 
interface GigabitEthernet0/1
port-type nni
!
interface GigabitEthernet0/2
port-type nni
!
interface Vlan1
no ip address
no ip route-cache
no ip mroute-cache
shutdown
!
interface Vlan10
ip address 192.168.1.76 255.255.255.0
!
ip default-gateway 192.168.1.3
no ip http server
ip classless
!
!
!
control-plane
!
!
line con 0
session-timeout 120
exec-timeout 120 0
speed 115200
line vty 0 4
password cisco
no login
line vty 5 15
no login
!
!
end

 

To store the configuration or changes you have made to your startup configuration in flash memory, enter this privileged EXEC command:

 

Switch# copy running-config startup-configuration
Destination filename [startup-configuration]?
Building configuration...

 

This command saves the configuration settings that you made. If you fail to do this, your configuration will be lost the next time you reload the system. To display information stored in the NVRAM section of flash memory, use the show startup-configuration or more startup-configuration privileged EXEC command.

For more information about alternative locations from which to copy the configuration file, see Appendix B, “Cisco IOS File System, Configuration Files, and Software Images.”

Modifying the Startup Configuration

This section describes how to modify the startup configuration, and contains the following sections:

See also Appendix B, “Cisco IOS File System, Configuration Files, and Software Images,” for information about switch module configuration files.

Default Boot Configuration

Table 4-3 shows the default boot configuration.

 

Table 4-3 Default Boot Configuration

Feature
Default Setting

Operating system software image

The switch module attempts to automatically boot the system using information in the BOOT environment variable. If the variable is not set, the switch module attempts to load and execute the first executable image it can by performing a recursive, depth-first search throughout the flash file system.

The Cisco IOS image is stored in a directory that has the same name as the image file (excluding the.bin extension).

In a depth-first search of a directory, each encountered subdirectory is completely searched before continuing the search in the original directory.

Configuration file

Configured switch modulees use the config.text file stored on the system board in flash memory.

A new switch module has no configuration file.

Automatically Downloading a Configuration File

You can automatically download a configuration file to your switch module by using the DHCP-based autoconfiguration feature. For more information, see the “Understanding DHCP-Based Autoconfiguration” section.

Specifying the Filename to Read and Write the System Configuration

By default, the Cisco IOS software uses the file config.text to read and write a nonvolatile copy of the system configuration. However, you can specify a different filename, which will be loaded during the next boot cycle.

Beginning in privileged EXEC mode, follow these steps to specify a different configuration filename:

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Specify the configuration file to load during the next boot cycle.

For file-url, specify the path (directory) and the configuration filename.

Filenames and directory names are case sensitive.

boot config-file flash:/ file-url

Step 3

Return to privileged EXEC mode.

end

Step 4

Verify your entries.

The boot config-file global configuration command changes the setting of the CONFIG_FILE environment variable.

show boot

Step 5

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

To return to the default setting, use the no boot config-file global configuration command.

Booting Manually

By default, the switch module automatically boots; however, you can configure it to manually boot.

Beginning in privileged EXEC mode, follow these steps to configure the switch module to manually boot during the next boot cycle:

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Enable the switch module to manually boot during the next boot cycle.

boot manual

Step 3

Return to privileged EXEC mode.

end

Step 4

Verify your entries.

The boot manual global command changes the setting of the MANUAL_BOOT environment variable.

The next time you reboot the system, the switch module is in boot loader mode, shown by the switch: prompt. To boot the system, use the boot filesystem :/ file-url boot loader command.

  • For filesystem :, use flash: for the system board flash device.
  • For file-url, specify the path (directory) and the name of the bootable image.

Filenames and directory names are case sensitive.

show boot

Step 5

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

To disable manual booting, use the no boot manual global configuration command.

Booting a Specific Software Image

By default, the switch module attempts to automatically boot the system using information in the BOOT environment variable. If this variable is not set, the switch module attempts to load and execute the first executable image it can by performing a recursive, depth-first search throughout the flash file system. In a depth-first search of a directory, each encountered subdirectory is completely searched before continuing the search in the original directory. However, you can specify a specific image to boot.

Beginning in privileged EXEC mode, follow these steps to configure the switch module to boot a specific image during the next boot cycle:

 

Step
Command

Step 1

Enter global configuration mode.

configure terminal

Step 2

Configure the switch module to boot a specific image in flash memory during the next boot cycle.

  • For filesystem :, use flash: for the system board flash device.
  • For file-url, specify the path (directory) and the name of the bootable image.

Filenames and directory names are case sensitive.

boot system filesystem :/ file-url

Step 3

Return to privileged EXEC mode.

end

Step 4

Verify your entries.

The boot system global command changes the setting of the BOOT environment variable.

During the next boot cycle, the switch module attempts to automatically boot the system using information in the BOOT environment variable.

show boot

Step 5

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

To return to the default setting, use the no boot system global configuration command.

Controlling Environment Variables

The switch module boot loader software provides support for nonvolatile environment variables, which can be used to control how the boot loader, or any other software running on the system, behaves. Boot loader environment variables are similar to environment variables that can be set on UNIX or DOS systems.

Environment variables that have values are stored in flash memory outside of the flash file system.

Each line in these files contains an environment variable name and an equal sign followed by the value of the variable. A variable has no value if it is not listed in this file; it has a value if it is listed in the file even if the value is a null string. A variable that is set to a null string (for example, “ ”) is a variable with a value. Many environment variables are predefined and have default values.

Environment variables store two kinds of data:

  • Data that controls code, which does not read the Cisco IOS configuration file. For example, the name of a boot loader helper file, which extends or patches the functionality of the boot loader can be stored as an environment variable.
  • Data that controls code, which is responsible for reading the Cisco IOS configuration file. For example, the name of the Cisco IOS configuration file can be stored as an environment variable.

You can change the settings of the environment variables by accessing the boot loader or by using Cisco IOS commands. Under normal circumstances, it is not necessary to alter the setting of the environment variables.


Note For complete syntax and usage information for the boot loader commands and environment variables, see the command reference for this release.


Table 4-4 describes the function of the most common environment variables.

 

Table 4-4 Environmental Variables

Variable
Boot Loader Command
Cisco IOS Global Configuration Command

BOOT

set BOOT filesystem :/ file-url...

A semicolon-separated list of executable files to try to load and execute when automatically booting. If the BOOT environment variable is not set, the system attempts to load and execute the first executable image it can find by using a recursive, depth-first search through the flash file system. If the BOOT variable is set but the specified images cannot be loaded, the system attempts to boot the first bootable file that it can find in the flash file system.

boot system f ilesystem:/file-url...

Specifies the Cisco IOS image to load during the next boot cycle. This command changes the setting of the BOOT environment variable.

MANUAL_BOOT

set MANUAL_BOOT yes

Decides whether the switch module automatically or manually boots.

Valid values are 1, yes, 0, and no. If it is set to no or 0, the boot loader attempts to automatically boot the system. If it is set to anything else, you must manually boot the switch module from the boot loader mode.

boot manual

Enables manually booting the switch module during the next boot cycle and changes the setting of the MANUAL_BOOT environment variable.

The next time you reboot the system, the switch module is in boot loader mode. To boot the system, use the boot flash: filesystem :/ file-url boot loader command, and specify the name of the bootable image.

CONFIG_FILE

set CONFIG_FILE flash:/ file-url

Changes the filename that Cisco IOS uses to read and write a nonvolatile copy of the system configuration.

boot config-file flash: / file-url

Specifies the filename that Cisco IOS uses to read and write a nonvolatile copy of the system configuration. This command changes the CONFIG_FILE environment variable.

Scheduling a Reload of the Software Image

You can schedule a reload of the software image to occur on the switch module at a later time (for example, late at night or during the weekend when the switch module is used less), or you can synchronize a reload network-wide (for example, to perform a software upgrade on all switch modulees in the network).


Note A scheduled reload must take place within approximately 24 days.


Configuring a Scheduled Reload

To configure your switch module to reload the software image at a later time, use one of these commands in privileged EXEC mode:

  • reload in [ hh : ] mm [ text ]

This command schedules a reload of the software to take affect at the specified minutes, or hours and minutes. The reload must take place within approximately 24 days. You can specify the reason for the reload in a string up to 255 characters in long.

  • reload at hh : mm [ month day | day month ] [ text ]

This command schedules a reload of the software to take place at the specified time (using a 24-hour clock). If you specify the month and day, the reload is scheduled to take place at the specified time and date. If you do not specify the month and day, the reload takes place at the specified time on the current day (if the specified time is later than the current time) or on the next day (if the specified time is earlier than the current time). Specifying 00:00 schedules the reload for midnight.


Note Use the at keyword only if the switch module system clock has been set (through Network Time Protocol (NTP), the hardware calendar, or manually). The time is relative to the configured time zone on the switch module. To schedule reloads across several switches to occur simultaneously, the time on each switch module must be synchronized with NTP.


The reload command halts the system. If the system is not set to manually boot, it reboots itself. Use the reload command after you save the switch module configuration information to the startup configuration (copy running-config startup-config).

If your switch module is configured for manual booting, do not reload it from a virtual terminal. This restriction prevents the switch module from entering the boot loader mode and thereby taking it from the remote user’s control.

If you modify your configuration file, the switch module prompts you to save the configuration before reloading. During the save operation, the system requests whether you want to proceed with the save if the CONFIG_FILE environment variable points to a startup configuration file that no longer exists. If you proceed in this situation, the system enters setup mode upon reload.

This example shows how to reload the software on the switch module on the current day at 19:30:

 

Switch# reload at 19:30
Reload scheduled for 19:30:00 UTC Fri June 3 2011 (in 2 hours and 25 minutes)
Proceed with reload? [confirm]

 

To cancel a previously scheduled reload, use the reload cancel privileged EXEC command.

Displaying Scheduled Reload Information

To display information about a previously scheduled reload or to find out if a reload has been scheduled on the switch module, use the show reload privileged EXEC command.

It displays reload information including the time the reload is scheduled to occur and the reason for the reload (if it was specified when the reload was scheduled).