Using the Cisco Command-Line Interface and Configuring Cisco IOS Software Notes
Accessing the Cisco Catalyst Switch Command-Line Interface (CLI)
Command-Line Interface (CLI) Overview * Cisco utilizes the CLI concept for its router products and the majority of its Catalyst LAN switch products. * Definition: The CLI is a text-based interface where users—typically network engineers—enter text commands and press the Enter key. * Logic Flow: Pressing Enter transmits the command to the switch. The switch executes the command and, in certain instances, replies with status messages detailing the results. * Alternative Interfaces: Cisco Catalyst switches also support non-CLI methods for monitoring and configuration, such as a web-based interface.
Cisco Catalyst Switch Families * The Cisco Catalyst brand encompasses a diverse range of switch series or families. * Series/Family Characteristics: Each series contains specific models sharing similar features, internal components, and price-versus-performance trade-offs. * 2960 Series Positioning: Cisco positions the series as full-featured, low-cost wiring closet switches for enterprises. These are primarily utilized as access switches.
Monitoring Switch Status via LEDs * Switch hardware includes several Light Emitting Diodes (LEDs) for status and troubleshooting during initial power-on and ongoing operations. * Most Cisco Catalyst switches feature an LED for every physical Ethernet interface. * Specific LED Descriptions (Example: Catalyst 2960): * SYST (System): Indicates overall system status. * Off: Switch is not powered on. * On (green): Switch is powered on and operational (Cisco IOS has successfully loaded). * On (amber): System has power but is not functioning correctly. * RPS (Redundant Power Supply): Indicates the status of the backup power supply. * STAT (Status): If lit green, it indicates that each port LED displays that specific port’s status. * STAT Mode Port LED Off: Link is not working or is shut down. * STAT Mode Solid Green: Link is operational, but no traffic is currently being transmitted. * STAT Mode Flashing Green: Link is operational and traffic is passing over the interface. * STAT Mode Flashing Amber: Port is currently blocked by spanning tree. * DUPLX (Duplex): If lit green, port LEDs indicate the duplex mode. On/Green indicates full duplex; off indicates half duplex. * SPEED: If lit green, port LEDs indicate the speed of the individual ports: * Off: * Solid Green: * Flashing Green: * MODE Button: A physical button used to cycle the meaning of LEDs through three states: STAT, DUPLX, and SPEED. * Port LED: Individual LEDs whose meanings change based on the mode selected by the MODE button.
Methods for Accessing the Cisco IOS CLI
Cisco Internetwork Operating System (IOS) * Definition: The operating system software required by Cisco switches to implement and control logic and functions. * Function: Controls switch performance and behavior while defining the human-centric CLI. * Interaction: A terminal emulation program accepts user text. Upon pressing Enter, the emulator sends text to the switch, which processes it as a command and sends a response back.
Comparison of Access Methods * Console: * A physical port built specifically for CLI access. * Requires a physical connection between a PC and the switch console port. * Requires terminal emulation software on the PC. * Telnet and Secure Shell (SSH): * These methods utilize the IP network where the switch resides. * They require software on the user device but rely on the existing TCP/IP network rather than a dedicated console cable.
Cabling the Console Connection * Components: Physical console port on the switch, physical serial port on the PC, and a compatible cable. * Older Connections: Used a PC serial port (typically a D-shell -pin connector called a DB-) connected to an RJ- console port on the switch. * USB Adapters: Standard USB to RS232 DB9 Serial Adapter cables can connect console cables to modern USB ports on PCs. * Rollover Cable Pinouts: The standard console cable uses rollover pinouts with eight wires. Pin rolls to pin , pin to pin , pin to pin , and so on. * Modern Console Ports: Newer routers and switches include USB ports for console access, allowing a standard USB cable to connect from a PC USB port directly to the switch’s USB console port.
Terminal Emulator Configuration for Console * The terminal emulator treats all data as text and must match the switch's default console port settings: * Speed: * Flow Control: None (No hardware flow control) * Data Format: -bit ASCII * Parity: None * Stop Bits:
Network-Based Access (Telnet and SSH) * Telnet: * A TCP-based application layer protocol using well-known port . * Follows a client-server model (Telnet client on PC, Telnet server on switch). * Requirement: Switch must have an IP address configured, and the network between the PC and switch must be operational. * Security Flaw: Telnet sends all data, including usernames and passwords, as clear-text. * Secure Shell (SSH): * A TCP-based protocol using well-known port . * Security: Encrypts all message contents to prevent packet capturing and password theft. * Encryption: Uses public key cryptography to exchange a shared session key. * Requirement: Requires both a password and a username for login.
CLI Modes and Navigation
Password Security Levels * By default, only console access is allowed. When Telnet or SSH are enabled, password security must be configured. * Lines: * Console Line: Referred to as
line console 0. * Virtual Terminal (vty) Lines: Switches support concurrent Telnet/SSH sessions, referenced asline vty 0 15.EXEC Modes * User EXEC Mode (User Mode): * Allows the user to view status without changing settings (‘look around but not break anything’). * Prompt: hostname followed by
>(e.g.,Switch>). * Enable Mode (Privileged EXEC Mode/Privileged Mode): * A more powerful mode supporting a superset of commands, including disruptive ones likereload(reboots IOS). * Prompt: hostname followed by#(e.g.,Switch#). * Transitioning: Use theenablecommand to enter anddisableto exit back to user mode.CLI Help Features *
?: Displays all available commands in the current mode. *help: Provides text describing how to use the help system (does not list commands). *Command?: Shows the first parameter options for a command. *com?: Lists all commands starting with the characters "com". *command parm?: (No space) Lists all parameters starting with those characters. *command parm1 ?: (With space) Lists all next parameters with brief explanations. *Tab Key: Completes a partially typed parameter or command. If it does nothing, the string is ambiguous (matches multiple possibilities).Keyboard Shortcuts for Editing and Recall * Up arrow / Ctrl-P: Displays the most recently used command (Previous). * Down arrow / Ctrl-N: Scrolls forward to more recent commands (Next). * Left arrow / Ctrl-B: Moves cursor backward without deleting (Back). * Right arrow / Ctrl-F: Moves cursor forward without deleting (Forward). * Backspace: Moves cursor backward and deletes characters. * Ctrl-A: Moves cursor to the absolute start of the current command. * Ctrl-E: Moves cursor to the absolute end of the current command. * Ctrl-R: Redisplays the command line (clears screen clutter from system messages). * Ctrl-D: Deletes a single character. * Ctrl-Shift-6: Interrupts the execution of the current command.
Monitoring and Configuration Commands
The show and debug Commands * show: The most popular IOS command. It provides a "photograph" or snapshot of the current status of almost every IOS feature. * debug: Acts like a "movie" or ongoing monitor. It asks the switch to monitor processes and send log messages to the user as events occur. * terminal monitor: A command used in enable mode to force log/debug messages to appear in a Telnet or SSH terminal session (IOS does not do this by default over IP). * Reload impacts: A switch
reloaddisables all currently active debug options.Configuration Mode * Logic: Commands entered here update the active configuration immediately upon pressing Enter. * Global Configuration Mode: Entered via
configure terminalfrom enable mode. * Configuration Submodes (Contexts): * Interface Mode: prompt changes to(config-if)#. Example:interface fastethernet 0/1. * VLAN Mode: prompt changes to(config-vlan)#. Example:vlan 10. * Console Line Mode: prompt changes to(config-line)#. Example:line console 0. * VTY Line Mode: prompt changes to(config-line)#. Example:line vty 0 15. * Exiting Modes: *exit: Moves back one level in the hierarchy. *endorCtrl-Z: Exits configuration mode entirely and returns to enable mode (#).
Switch Memory and File Management
Four Main Types of Memory 1. RAM (DRAM): Working storage. Holds the running-config (active configuration). 2. ROM: Stores the bootstrap/boothelper program used at power-on to find and load the IOS image into RAM. 3. Flash Memory: Stores fully functional Cisco IOS images. It is the default boot location and can store backup configuration files. 4. NVRAM (Nonvolatile RAM): Stores the startup-config file used during switch initialization or reload.
Managing Configuration Files * Persistence: Changes made in config mode are only in RAM. Loss of power loses these changes unless they are copied to NVRAM. * The copy Command:
copy {from-location} {to-location}. *copy running-config startup-config: Saves active configuration to NVRAM. *copy startup-config running-config: Merges the NVRAM file into the active RAM configuration (does not replace). *copy tftp running-config: Moves configuration from a TFTP server into RAM. * Erasing Configuration: *write erase*erase startup-config*erase nvramInitial Configuration (Setup Mode) * Triggered automatically if the startup-config in NVRAM is empty during boot initialization. * The switch asks if the user wants to enter setup mode; if "yes," it prompts the administrator with a series of questions for basic parameters. * IOS builds a configuration from these answers, saves it to NVRAM, and loads it into RAM.
The show version Command Information * Cisco IOS software version. * Switch uptime (time since last load). * Reason for the last reload. * Inventory of interfaces (Number of Fast Ethernet and Gigabit Ethernet interfaces). * Switch model number.
Command Reference Summary
Configuration Commands: *
hostname {name}: Sets the switch host name and prompt prefix. *login: (Context: Line) Tells IOS to prompt for a password when logging in. *password {value}: (Context: Line) Defines the password required by thelogincommand.EXEC Mode Management: *
enable: Move from user to enable mode. *disable: Move from enable to user mode. *quit: Disconnects the user from the CLI session. *no debug all/undebug all: Disables all active debugging. *show running-config: Displays the current configuration in RAM. *show startup-config: Displays the saved configuration in NVRAM.