Cisco Systems


 


 

Modules:  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  10  |  11  |  CS  |  All  |
Module 5: Managing Cisco IOS Software
Module Overview  
5.1 Router Boot Sequence and Verification
 
5.1.1 Stages of the router power-on boot sequence
5.1.2 How a Cisco device locates and loads IOS
5.1.3 Using the boot system command
5.1.4 Configuration register
5.1.5 Troubleshooting IOS boot failure
 
5.2 Managing the Cisco File System
 
5.2.1 IOS file system overview
5.2.2 IOS naming conventions
5.2.3 Managing configuration files using TFTP
5.2.4 Managing configuration files using copy and paste
5.2.5 Managing IOS images using TFTP
5.2.6 Managing IOS images using Xmodem
5.2.7 Environment variables
5.2.8 File system verification
 
Module Summary  
Module Quiz

 

 
Close Window
All contents copyright © 2003 Cisco Systems, Inc. All rights reserved.

 

Overview
 
A Cisco router cannot operate without the Cisco Internetworking Operating System (IOS). Each Cisco router has a predetermined boot-up sequence for locating and loading the IOS. This module will describe the stages and importance of this boot up procedure.

Cisco internetworking devices operate using several different files, including Cisco Internetwork Operating System (IOS) images and configuration files. A network administrator who wishes to keep the network running smoothly and reliably must carefully manage these files to ensure that the proper versions are used and that necessary backups are performed. This module also describes the Cisco file system and provides the tools to manage it effectively.

Students completing this module should be able to:

  • Identify the stages of the router boot sequence
  • Determine how a Cisco device locates and loads the Cisco IOS
  • Use the boot system command
  • Identify the configuration register values
  • Briefly describe the files used by the Cisco IOS and their functions
  • List the locations on the router of the different file types
  • Briefly describe the parts of the IOS name
  • Save and restore configuration files using TFTP and copy-and-paste
  • Load an IOS image using TFTP
  • Load an IOS image using XModem
  • Verify the file system using show commands

    

5.1 Router Boot Sequence and Verification  
  5.1.1 Stages of the router power-on boot sequence  
  The goal of the startup routines for Cisco IOS software is to start the router operations. The router must deliver reliable performance in its job of connecting any configured networks. To do this, the startup routines must do the following:
  • Test the router hardware.
  • Find and load the Cisco IOS software.
  • Find and apply configuration statements, including protocol functions and interface addresses.

Figure illustrates the sequence and services used to initialize the router.

  Interactive Media Activity

Drag and Drop: Router Boot Sequence

When the student has completed this activity, the student will be able to understand the sequence in which a router boots up.

   

  Web Links

Router Setup and Startup

http://csc.colstate.edu/summers/ NOTES/CS458/chap11/ tsld004.htm

 

5.1 Router Boot Sequence and Verification  
  5.1.2 How a Cisco device locates and loads IOS  
  The default source for Cisco IOS software depends on the hardware platform, but most commonly the router looks to the boot system commands saved in NVRAM. Cisco IOS software allows several alternatives to be used. Other sources can be specified for the software, or the router can use its own fallback sequence to load the software.

The settings in the configuration register enable the following alternatives:

  • Global configuration mode boot system commands can be specified to enter fallback sources for the router to use in sequence. The router will use these commands as needed, in sequence, when it restarts.
  • If NVRAM lacks boot system commands that the router can use, the system by default uses the Cisco IOS software in flash memory.
  • If flash memory is empty, the router then attempts to use TFTP to load an IOS image from the network. The router uses the configuration register value to form a filename from which to boot a default system image stored on a network server.

 

  Interactive Media Activity

Drag and Drop: How A Cisco Device Locates And Loads IOS

When the student has completed this activity, the student will be able to identify the process a Cisco device goes through in order to find IOS during boot-up.

   

  Web Links

Cisco IOS

http://csc.colstate.edu/summers/ NOTES/CS458/ chap11/tsld006.htm

 

 

5.1 Router Boot Sequence and Verification  
  5.1.3 Using the boot system command  
  The following examples show the use of multiple boot system commands to specify the fallback sequence for booting Cisco IOS software. The three examples show boot system entries which specify that a Cisco IOS software image will load first from flash memory, then from a network server, and finally from ROM:
  • Flash memory – A system image from flash memory can be loaded. The advantage is that information stored in flash memory is not vulnerable to network failures that can occur when loading system images from TFTP servers.
  • Network server – In case flash memory becomes corrupted, a system image can be loaded from a TFTP server.
  • ROM – If flash memory is corrupted and the network server fails to load the image, booting from ROM is the final bootstrap option in software. However, the system image in ROM will likely be a subset of the Cisco IOS that lacks the protocols, features and configurations of the full Cisco IOS. Also, if the software has been updated since the router was purchased, the router may have an older version stored in ROM. 

The command copy running-config startup-config saves the commands in NVRAM. The router will execute the boot system commands as needed in the order in which they were originally entered into configuration mode.

  Lab Activity

Lab Exercise: Using the Boot System Command

In this lab, the students will display information about the Cisco IOS Image that runs on the router.

 

   

  Lab Activity

e-Lab Activity: Preparing for Boot System Commands

In this lab, the students will display information relating to the router boot procedure, using the appropriate show commands.

 

   

  Web Links

boot system Global Configuration Commands

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_command_reference_ chapter09186a00800ca743.html#1017706

 

5.1 Router Boot Sequence and Verification  
  5.1.4 Configuration register  
  The order in which the router looks for system bootstrap information depends on the boot field setting in the configuration register. The default configuration register setting can be changed with the global configuration mode command config-register. Use a hexadecimal number as the argument for this command.

The configuration register is a 16-bit register in NVRAM. The lowest four bits of the configuration register form the boot field. To ensure that the upper 12 bits are not changed, first retrieve the current values of the configuration register using the show version command. Then use the config-register command, changing only the value of the last hexadecimal digit.

To change the boot field in the configuration register, follow these guidelines:

  • To enter the ROM monitor mode, set the configuration register value to 0xnnn0, where nnn represents the previous value of the non-boot field digits. This value sets the boot field bits to 0000 binary. From ROM monitor, boot the operating system manually by using the b command at the ROM monitor prompt.
  • To configure the system to boot automatically from ROM, set the configuration register to 0xnnn1, where nnn represents the previous value of the non-boot field digits. This value sets the boot field bits to 0001 binary.
  • To configure the system to use the boot system commands in NVRAM, set the configuration register to any value from 0xnnn2 to 0xnnnF, where nnn represents the previous value of the non-boot field digits. These values set the boot field bits to a value between 0010 and 1111 binary. Using boot system commands in NVRAM is the default.
  Lab Activity

e-Lab Activity: Configuration Register

In this lab, the students will learn to change the boot procedure of the router.

 

   

  Web Links

config-register Global Configuration Command

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_command_reference_ chapter09186a00800ca743.html#1017887

 

5.1 Router Boot Sequence and Verification  
  5.1.5 Troubleshooting IOS boot failure  
  In the event that the router does not boot properly, there are several things that could be wrong:
  • Configuration file has missing or incorrect boot system statement
  • Incorrect configuration register value
  • Corrupted flash image
  • Hardware failure

When the router boots, it looks in the configuration file for a boot system statement. This boot system statement can force the router to boot from another image instead of the IOS in flash. To identify the boot image source, type the show version command and look for the line that identifies the image boot source.

Use the show running-config command and look for a boot system statement near the top of the configuration. If the boot system statement points to an incorrect IOS image, delete the statement using the “no” version of the command.

An incorrect configuration register setting will prevent the IOS from loading from flash. The value in the configuration register tells the router where to get the IOS. This can be confirmed by using the show version command and looking at the last line for the configuration register. The correct value varies from hardware platform to hardware platform. A part of the documentation of the internetwork should be a printed copy of the show version output. If that documentation is not available, there are resources on the Cisco documentation CD or Cisco website to identify the correct configuration register value. Correct this by changing the configuration register in the configuration and saving this as the start-up configuration.

If there is still a problem, the router may have a corrupted flash image file. If this is the case, an error message should be displayed during boot. That message may take one of several forms. Some examples are:

  • open: read error...requested 0x4 bytes, got 0x0
  • trouble reading device magic number
  • boot: cannot open "flash:"
  • boot: cannot determine first file name on device "flash:"ú

If the flash image is corrupt, a new IOS should be uploaded into the router.

If none of the above appears to be the problem, the router could have a hardware failure. If this is the case, the Cisco Technical Assistance (TAC) center should be contacted. Although hardware failures are rare, they do occur.

Note: The value of the configuration register is not displayed by either the show running-config or show startup-config commands.

  Lab Activity

Lab Exercise: Troubleshooting Configuration Register Boot Problems

In this lab, the students will check and document the configuration register settings related to the boot method.

 

 

  Lab Activity

e-Lab Activity: Troubleshooting IOS Boot Failure

In this lab, the students will check and document the configuration register settings related to the boot method, configure the router to boot from NVRAM, and reload the router.

 

 

5.2 Managing the Cisco File System  
  5.2.1 IOS file system overview  
  Routers and switches depend on software for their operation. The two types of software required are operating systems and configuration.

The operating system used in almost all Cisco devices is the Cisco Internetwork Operating System (IOS). The Cisco IOS® is the software that allows the hardware to function as a router or switch. The IOS file is several megabytes.

The software a router or switch uses is referred to as the configuration file or the config. The configuration contains the “instructions” that define how the device is to route or switch. A network administrator creates a configuration that defines the desired functionality of the Cisco device. The functions that can be specified by the configuation are the IP addresses of the interfaces, routing protocols, and networks to be advertised. The configuration file typically is a few hundred to a few thousand bytes.

Each of the software components is stored in memory as a separate file. These files are also stored in different types of memory.

The IOS is stored in a memory area called flash. Flash memory provides non-volatile storage of an IOS that can be used as an operating system at startup. The flash allows the IOS to be upgraded or stores multiple IOS files. In many router architectures, the IOS is copied into and run from Random Access Memory (RAM).

A copy of the configuration file is stored in Non-volatile RAM (NVRAM) to be used as a configuration during startup. This is referred to as the “startup config”. The startup configuration is copied into RAM at boot time. This configuration in RAM is the configuration used to operate the router. It is referred to as the “running config”.

Beginning with version 12 of the IOS, a single interface to all the file systems that a router uses is provided. This is referred to as the Cisco IOS File System (IFS). The IFS provides a single method to perform all the file system management that a router uses. This would include the flash memory file systems, the network file systems (TFTP, rcp, and FTP), and reading or writing data (such as NVRAM, the running configuration, ROM). The IFS uses a common set of prefixes to specify file system devices.

The IFS uses the URL convention to specify files on network devices and the network. The URL convention identifies the location of the configuration files following the colon as [[[//location]/directory]/filename]. The IFS also supports FTP file transfer.

 

  Interactive Media Activity

Drag and Drop: IOS File System Overview

When the student has completed this activity, the student will be able to list the configuration files and their locations.

 

 

5.2 Managing the Cisco File System  
  5.2.2 IOS naming conventions  
  Cisco develops many different versions of the IOS. The IOS supports varied hardware platforms and features. Cisco is also continuously developing and releasing new versions of the IOS.

To identify the different versions, Cisco has a naming convention for IOS files. This IOS naming convention uses different fields in the name. Among the fields are the hardware platform identification, the feature set identification, and the numerical release.

The first part of the Cisco IOS file name identifies the hardware platform for which this image is designed.

The second part of the IOS file name identifies the various features that this file contains. There are many different features to choose from. These features are packaged in "software images". Each feature set contains a specific subset of Cisco IOS features. Examples of feature-set categories are:

  • Basic – A basic feature set for the hardware platform, for example IP and IP/FW
  • Plus – A basic feature set plus additional features such as IP Plus, IP/FW Plus, and Enterprise Plus
  • Encryption – The addition of the 56-bit data encryption feature sets, such as Plus 56, to either a basic or plus feature set. Examples include IP/ATM PLUS IPSEC 56 or Enterprise Plus 56. From Cisco IOS Release 12.2 onwards, the encryption designators are k8/k9:
    • k8 – Less than or equal to 64-bit encryption in IOS version 12.2 and up
    • k9 – Greater than 64-bit encryption (on 12.2 and up)

The third part of the file name indicates the file format. It specifies if the IOS is stored in flash in a compressed format and whether the IOS is relocatable. If the flash image is compressed, the IOS must be expanded during boot as it is copied to RAM. A relocatable image is copied from flash into RAM to run. A non-relocatable image is run directly from flash.

The fourth part of the file name identifies the release of the IOS. As Cisco develops newer versions of the IOS, the numerical version number increases.

 

  Interactive Media Activity

Drag and Drop: IOS Naming Conventions

When the student has completed this activity, the student will be able to identify the different fields in an IOS image name.

 

  Web Links

Loading and Maintaining System Images

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_configuration_guide_ chapter09186a00800c6c63.html#xtocid3

 

 

5.2 Managing the Cisco File System  
  5.2.3 Managing configuration files using TFTP  
  In a Cisco router or switch, the active configuration is in RAM and the default location for the startup configuration is NVRAM. In the event the configuration is lost, this startup configuration should be backed up. One of these backup copies of the configuration can be stored on a TFTP server. The copy running-config tftp command can be used to do this. The steps for this process are listed below:
  • Enter the command copy running-config tftp.
  • At the prompt, enter the IP address of the TFTP server to store the configuration file.
  • Enter the name to assign to the configuration file or accept the default name.
  • Confirm the choices by typing yes each time.

Loading the backup configuration file from a TFTP server can restore the router configuration. The steps below outline this process:

  • Enter the command copy tftp running-config.
  • At the prompt, select a host or network configuration file.
  • At the system prompt, enter the IP address of the TFTP server where the configuration file is located.
  • At the system prompt, enter the name of the configuration file or accept the default name.
  • Confirm the configuration filename and the server address that the system supplies.
  Lab Activity

Managing Configuration Files with TFTP

In this lab, the students will backup a copy of a router configuration file and reload the backup configuration file from a TFTP server into RAM on a router.

 

  Web Links

Loading and Maintaining System Images

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_configuration_guide_ chapter09186a00800c6c63.html#xtocid23

 

5.2 Managing the Cisco File System  
  5.2.4 Managing configuration files using copy and paste  
  Another way to create a backup copy of the configuration is to capture the output of the show running-config command. This can be done from the terminal session by copying the output, pasting to a text file, then saving the text file. This file will need some editing before it can be used to restore configuration to the router.

Perform the following to capture the configuration using the text displayed on the HyperTerminal screen to a text file:

  1. Select Transfer
  2. Select Capture Text
  3. Specify the name for the text file to capture the configuration
  4. Select Start to start capturing text
  5. Display the configuration to the screen by entering show running-config
  6. Press the space bar when each "-More -" prompt appears
  7. When the complete configuration has been displayed, stop the capture by:
  8. Select Transfer
  9. Select Capture Text
  10. Select Stop

After the capture is complete, the configuration file needs to be edited to remove extra text. To create this in a form to be “pasted” back into the router, remove any unnecessary information from the captured configuration. Comments may also be added to explain the various parts of the configuration. A comment is added by beginning a line with an exclamation mark “!”.

The configuration file can be edited from a text editor such as Notepad. To edit the file from Notepad click on File > Open. Find the captured file and select it. Click Open.

The lines that need to be deleted contain:

  • show running-config
  • Building configuration...
  • Current configuration:
  • - More -
  • Any lines that appear after the word "End"

At the end of each of the interface sections add the no shutdown command. Clicking File > Save will save the clean version of the configuration.

The backup configuration can be restored from a HyperTerminal session. Before the configuration is restored any remaining configuration should be removed from the router. This can be done by entering the command erase startup-config at the privileged EXEC router prompt and then restarting the router by entering the reload command.

HyperTerminal can be used to restore a configuration. The clean backup of the configuration can be copied into the router.

  • Enter router global configuration mode.
  • From HyperTerminal, click on Transfer > Send Text File.
  • Select the name of the file for the saved backup configuration.
  • The lines of the file will be entered into the router as if they were being typed.
  • Observe any errors.
  • After the configuration is entered, press Ctrl-Z key to exit global configuration mode.
  • Restore the startup configuration with copy running-config startup-config.
  Web Links

Operating and Maintaining Cisco Devices: Using Cisco Info Center

http://www.cisco.com/en/US/netsol/ns110/ ns5/ns7/ns18/networking_solutions_design_guide_ chapter09186a00800bcd02.html

 

5.2 Managing the Cisco File System  
  5.2.5 Managing IOS images using TFTP  
  Occasionally the router will need to have the IOS upgraded or restored. When a router first arrives, the IOS should be backed up. This IOS image can be stored in a central server with other IOS images. These images can be used to restore or upgrade the IOS on the routers and switches in the internetwork.

This server should have a TFTP service running. The IOS backup can be initiated from the privileged EXEC mode with the copy flash tftp command.

The router will prompt the user to enter the IP address of the TFTP server. When prompted for the filename of the IOS image on the server, the router may then prompt to erase flash. This often happens if there is not sufficient flash available for the new image. As the image is erased from flash, a series of “e’s” will appear to show the erase process.

As each datagram of the IOS image file is downloaded, an “!” will be displayed. This IOS image is several megabytes and may take some time.

The new flash image will be verified after it is downloaded. The router is now ready to be reloaded to use the new IOS image.

  Lab Activity

Lab Exercise: Managing IOS Images with TFTP

In this lab, the students will backup a copy of a router IOS from flash to a TFTP server.

 

 

  Web Links

Loading and Maintaining System Images

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_configuration_guide_ chapter09186a00800c6c63.html#xtocid23

 

5.2 Managing the Cisco File System  
  5.2.6 Managing IOS images using Xmodem  
  If the IOS image in flash has been erased or corrupted, the IOS may need to be restored from the ROM monitor mode (ROMmon). In many of the Cisco hardware architectures, the ROMmon mode is identified from the rommon 1 > prompt.

This first step in this process is to identify why the IOS image did not load from flash. This could be due to a corrupt or missing image. The flash should be examined with the dir flash: command.

If an image is located that appears to be valid, an attempt should be made to boot from that image. This is done using boot flash: command. For example if the image name was “c2600-is-mz.121-5”, the command would be:

rommon 1>boot flash:c2600-is-mz.121-5

If the router properly boots, then there are a couple of items that need to be examined to determine why the router booted to the ROMmon instead of using IOS from flash. First, use the show version command to check the configuration register to ensure that it is configured for the default boot sequence. If the configuration register value is correct, use the show startup-config command to see if there is a boot system command instructing the router to use the IOS for ROM monitor.

If the router will not properly boot from the image or there is no IOS image, a new IOS will need to be downloaded. The IOS file may be recovered using either Xmodem to restore the image through the console, or downloading the image using TFTP from the ROMmon mode.

Download using Xmodem from ROMmon
To restore the IOS through the console, the local PC needs to have a copy of the IOS file to restore and a terminal emulation program such as HyperTerminal. The IOS can be restored using the default console speed of 9600 bps. The baud rate can be changed to 115200 bps to speed up the download. The console speed can be changed from ROMmon mode using the
confreg command. After entering the confreg command, the router will prompt for the various parameters that can be changed.

When prompted “change console baud rate? y/n [n]:” selecting y will provide a prompt to select the new speed. After changing the console speed and restarting the router into the ROMmon mode, the terminal session (at 9600) should be terminated and a new session started at 115200 bps to match the console speed.

The Xmodem command can be used from the ROMmon mode to restore the IOS software image from the PC. The format of the command is xmodem -c image_file_name. For example, to restore an IOS image file with the name “c2600-is-mz.122-10a.bin”, type the command:

xmodem -c c2600-is-mz.122-10a.bin 

The -c instructs the Xmodem process to use Cyclic Redundancy Check (CRC) for error checking during the download.

The router will prompt not to begin the transfer and present a warning message. The warning message informs that the bootflash will be erased and asks to confirm continuing. When the process is continued, the router will then prompt to start the transfer.

Now the Xmodem transfer needs to be started from the terminal emulator. In HyperTerminal, select Transfer > Send File. Then in the Send File popup specify the image name/location, select Xmodem as the protocol, and start the transfer. During the transfer, the Sending File popup will display the status of the transfer.

Once the transfer is complete a message appears indicating that flash is being erased. This is followed by the “Download Complete!” message. Before restarting the router, the console speed needs to be set back to 9600 and the config register back to 0x2102. Enter the command config-register 0x2102 at the privileged EXEC prompt.

While the router is rebooting, the 115200 bps terminal session needs to be ended and a 9600 bps session begun.

  Lab Activity

Lab Exercise: Password Recovery Procedures

In this lab, the students will gain access to a router with an unknown privileged mode (enable) password.

 

  Lab Activity

Lab Exercise: Managing IOS Images with ROMmon and Xmodem

In this lab, the students will recover a Cisco 1700 series router using ROM monitor (ROMmon) (rommon >) due to a missing or corrupt IOS boot flash image.

 

  Web Links

Loading and Maintaining System Images

http://www.cisco.com/en/US/products/sw/ iosswrel/ps1835/products_configuration_guide_ chapter09186a00800c6c63.html#xtocid41

 

5.2 Managing the Cisco File System  
  5.2.7 Environment variables  
  The IOS can also be restored from a TFTP session. Downloading the image using TFTP from ROMmon is the fastest way to restore an IOS image to the router. This is done by setting environmental variables and then using the tftpdnld command.

Since the ROMmon has very limited functions, no configuration file is loaded during boot. The router therefore has no IP or interface configuration. The environmental variables provide a minimal configuration to allow for the TFTP of the IOS. The ROMmon TFTP transfer works only on the first LAN port so a simple set of IP parameters are set for this interface. To set a ROMmon environment variable, the variable name is typed, then the equal sign (=), and the value for the variable (VARIABLE_NAME=value). For example, to set the IP address to 10.0.0.1, type IP_ADDRESS=10.0.0.1 at the ROMmon prompt.

Note: All variable names are case sensitive.

The minimum variables required to use tftpdnld are:

  • IP_ADDRESS – The IP address on the LAN interface
  • IP_SUBNET_MASK – The subnet mask for the LAN interface
  • DEFAULT_GATEWAY – The default gateway for the LAN interface
  • TFTP_SERVER – The IP address of the TFTP server
  • TFTP_FILE – The IOS filename on the server

To check the ROMmon environment variables, the set command can be used.

Once the variables are set for the IOS download, the tftpdnld command is entered with no arguments. The ROMmon will echo the variables and then a confirmation prompt will appear with a warning that this will erase the flash.

As each datagram of the IOS file is received, a “!” will be displayed. When the complete IOS file has been received, the flash will be erased and the new IOS image file written. Appropriate messages will be displayed as the process is completed.

When the new image is written into flash and the ROMmon prompt is displayed, the router can be restarted by typing i. The router should now boot from the new IOS image in flash.

  Web Links

Loading and Maintaining System Images

http://www.cisco.com/en/US/products/sw/ iosswrel/ ps1835/ products_configuration_ guide_ chapter09186a00800c6c63.html#xtocid30

 

5.2 Managing the Cisco File System  
  5.2.8 File system verification  
  There are several commands that can be used to verify the router file system. One of those is the show version command. The show version command can be used to check the current image and the total amount of flash. It also verifies two other items concerning loading the IOS. It identifies the source of the IOS image that the router used to boot and displays the configuration register. The boot field setting of the configuration register can be examined to determine from where the router is to load the IOS. If these do not agree, there may be a corrupt or missing IOS image in flash or there may be boot system commands in the startup configuration.

The show flash command can also be used to verify the file system. This command is used to identify IOS image(s) in flash as well as the amount of flash that is available. This command is often used to confirm that there is ample space to store a new IOS image.

As previously mentioned, the configuration file may contain boot system commands. These commands can be used to identify the source of the desired IOS boot image. Multiple boot system commands may be used to create a fallback sequence to discover and load an IOS. These boot system commands will be processed in the order of their appearance in the configuration file.

 

Summary
  An understanding of the following key points should have been achieved:
  • Identifying stages of the router boot sequence
  • Identifying how the Cisco device locates and loads the Cisco IOS
  • Using the boot system command
  • Identifying the configuration register settings
  • Troubleshooting problems
  • Identifying the files used by the Cisco IOS and their functions
  • Identifying the locations on the router of the different file types
  • Identifying the parts of the IOS name
  • Managing configuration files using TFTP
  • Managing configuration files using copy-and-paste
  • Managing IOS images with TFTP
  • Managing IOS images with XModem
  • Verifying the file system using show commands