3-2 Using the Command-Line Interface (CLI)

3-2 Using the Command-Line Interface (CLI)

Once IOS has finished loading up, it will ask you to press Return to continue. While waiting for you to press return, it will display the status of every interface as shown below.
 
Press RETURN to get started!
*Mar  1 00:09:01.271: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*Mar  1 00:09:01.583: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
*Mar  1 00:09:02.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
*Mar  1 00:09:02.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Once you press enter, you will arrive at the Router> prompt. If the router has a startup config with authentication configured, such as in the case of most brand new ISRs, you will be prompted for a username and/or password before you will arrive at the prompt. For new ISRs cisco is the username and password. We will cover authentication later in the chapter. For now consider the prompt that you will see. The text before the greater-than sign (>) is the hostname of the device. By default Router or Switch is the default name depending on the device.
IOS modes
The CLI of the IOS is divided into different modes or levels. Each mode serves a different purpose and has different sets of commands. It is important to be familiar with different modes that you will encounter in this book. Covering all the modes is out of the scope of CCNA.
The character after the hostname of the device tells you which mode you are in. When you first start a router and press enter, you are at theRouter> prompt. The greater-than sign (>) tells you that you are in the user exec mode or level 1. This mode is mostly used to view statistics. You cannot view or edit configuration of the device from this mode. This mode also serves as the stepping-stone to the next mode, the privileged exec mode or level 15. At this level the prompt changes to the dollar sign (#). To go to the privileged exec mode from the user exec mode, type enable command on the prompt and press enter as shown below. Notice the change in prompt after the command is entered.
Router>enable
Router#
Congratulations! You just entered your first command on an IOS device.
To go back to the user exec mode, you can use the disable command as shown below:
Router#disable
Router>
To close the CLI session, use the logout command in any mode.
At the privileged exec mode you can view the configuration and statistics related to every component and process of the device but cannot make changes to the configuration. To be able to make changes to the configuration of the device, you will need to go to the global configuration mode using the configure terminal command in the privileged exec mode as shown below. Notice that the prompt changes toRouter(config)# after you enter the command. (config)# tells you that you are in the global configuration mode.
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#
In this mode, you can make changes to the configuration of the device. You must remember three things about the global configuration mode:
  1. All changes affect the running config. These changes are not persistent after a reboot unless running config is saved to the startup config.
  2. All changes have an immediate effect on the device.
  3. The global configuration mode has sub-modes. While some changes can be made in the global configuration mode, changes to specific components, such as interfaces, must be done in dedicated sub-modes.
From the global configuration mode you can go to different sub modes to configure specific components. While most of the sub modes are beyond the scope of CCNA, a few of the modes that you will come across in the book are discussed in Table 3-4.
Table 3-4 IOS Sub-modes
Sub-mode namePurposeSub-mode promptCommand to enter sub-mode
Interface ConfigurationIn this mode you can configure individual interfaces of the device. You can configure protocol, layer 3 addressing etc. in this mode.Router(config-if)#interface <interface-name>

Example:

Router(config)#interface fastEthernet 0/0
Router(config-if)#
Line configurationIn this mode you can configure the console, telnet and auxillary lines, which are used for exec sessions.Router(config-line)#line {con | vty | aux}number

Example:

Router(config)#line console 0
Router(config-line)#
Routing ConfigurationIn this mode you can configure the routing protocols.Router(config-router)#router protocol [number]

Example:

Router(config)#router rip
Router(config-router)#

IOS Editing and Help Features
While configuring a device running IOS, using the CLI is mostly about remembering the different commands and options. Cisco makes it easier to do this by providing various editing and help features. The help feature is a lifesaver. You can use a question mark (?) at any place to see a list of available commands or options, as shown below.
Router#configure ?
confirm            Confirm replacement of running-config with a new config
file
memory             Configure from NV memory
network            Configure from a TFTP network host
overwrite-network  Overwrite NV memory from TFTP network host
replace            Replace the running-config with a new config file
terminal           Configure from the terminal
<cr>
In the above output when a question mark (?) is entered after the configure command, a list of available options is displayed. Notice thatterminal is one of the options. Another example is given below.
Router#?
Exec commands:
access-enable        Create a temporary Access-List entry
access-profile       Apply user-profile to interface
access-template      Create a temporary Access-List entry
alps                 ALPS exec commands
archive              manage archive files
audio-prompt         load ivr prompt
auto                 Exec level Automation
beep                 Blocks Extensible Exchange Protocol commands
bfe                  For manual emergency modes setting
call                 Voice call
ccm-manager          Call Manager Application exec commands
cd                   Change current directory
clear                Reset functions
clock                Manage the system clock
cns                  CNS agents
configure            Enter configuration mode
connect              Open a terminal connection
copy                 Copy from one file to another
credential           load the credential info from file system
crypto               Encryption related commands.
ct-isdn              Run an ISDN component test command
–More–
In the above output, the numbers of options are more than the available screen size, hence the output pauses and you see the –More– text. At this point you can press space to see the rest of the output or press q to quit back to the prompt. A final example of the help feature is given below.
Router(config)#i?
identity      interface  ip   ipc
iphc-profile  ipv6       ipx  irec-agent
isis          iua        ivr  ixi
In the above output notice that a question mark was entered after a single character. This causes IOS to display a list of options starting with that character. You can enter a question mark after multiple characters to see a list of options starting with those characters. For example, type in? at the above prompt will show a list consisting of interface option only. This brings up an interesting feature of the CLI. If you type a few characters which are unique to a command and press the tab key, the IOS will complete the command for you. In fact if you type the first few unique characters of the command, you need not press tab or complete the command. IOS will understand which command you want. For example if you type int and press tab then IOS will complete the command. Another example is shown below.
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#
Notice that the configure terminal command is executed at conf t. The IOS sees that the only command which starts with conf is configure,while terminal is the only option which starts with t.
Apart from these help features, the IOS provides some meaningful messages when you enter an incomplete or wrong command. Take a look at few of these messages shown below.
Router#confguire terminal
^
% Invalid input detected at ‘^’ marker. 
The above message tells that there is an error in the command marked by the caret sign (^). Because of the sign, it is easy to see that there is a typing mistake in the command.
Router(config)#interface
% Incomplete command.
The above message tells that you have entered and incomplete command. More options are needed with the command. In such a situation, you can use the question mark after the command to see available options.
Router(config)#s
% Ambiguous command:  “s”
The above message shows that you have not typed enough unique characters. There are multiple commands that start with the characters that you have entered.
While using the CLI, these help features and messages are immensely useful, but you also need to know about a few key combinations that you can use while typing commands. Table 3-5 shows a list of these key combinations.
Table 3-5 IOS editing key combinations
Key or CombinationPurpose
Left Arrow or Ctrl+bMove cursor one character back
Right Arrow or Ctrl+fMove cursor one character forward
Esc+bMove cursor one word back
Esc+fMove cursor one word forward
Ctrl+aMove cursor to the start of line
Ctrl+eMove cursor to end of line
Ctrl+d or BackspaceDelete one character before the cursor
Ctrl+wDelete one word before the cursor
Ctrl+uDeletes the entire line
Ctrl+zLeave configuration mode and go back to privileged exec mode
Ctrl+p or Up arrowShows the previous command entered
Ctrl+n or Down arrowShows the next command entered after up arrow/Ctrl+p has been used.







Another useful feature of the CLI is the show history command. This command lists the last 20 commands that you have entered in the session. An example is shown below:
Router#show history
enable
configure terminal
exit
show version
show run
show history
The number of commands that can be stored by the router in the history can be changed using the terminal history size command. You use the command to change the size of history from 0 to 256. An example is shown below:
Router#terminal history size ?
<0-256> Size of history buffer
Router#terminal history size 25
The configured size of the history can be confirmed by using the show terminal command as shown below:
myRouter#show terminal
Line 194, Location: “”, Type: “XTERM-COLOR”
Length: 45 lines, Width: 202 columns
Baud rate (TX/RX) is 9600/9600
Status: PSI Enabled, Ready, Active, No Exit Banner, Automore On
Capabilities: none
Modem state: Ready
Special Chars: Escape  Hold  Stop  Start  Disconnect  Activation
^^x    none   –     –       none
Timeouts:      Idle EXEC    Idle Session   Modem Answer  Session   Dispatch
00:10:00        never                        none     not set
Idle Session Disconnect Warning
never
Login-sequence User Response
00:00:30
Autoselect Initial Wait
not set
Modem type is unknown.
Session limit is not set.
Time since activation: 00:00:31
Editing is enabled.
History is enabled, history size is 50.DNS resolution in show commands is enabled
Full user help is disabled
Allowed input transports are pad telnet rlogin lapb-ta mop v120 ssh.
Allowed output transports are pad telnet rlogin lapb-ta mop v120 ssh.
Preferred transport is telnet.
No output characters are padded
No special data dispatching characters
In the above output, you can see that history is enabled and the history size is 50.
The last feature of CLI that you need to know about before proceeding is the do command. As you already know, commands can only be entered in particular modes. For example, show terminal command can be executed only in the user privilege mode and not in the configuration mode. If you are in the configuration mode or one of the sub-configuration modes, you will need to exit out of that mode and get back to the user privilege mode to execute that command. This can be inconvenient at times when you want to quickly verify something while configuring the device. To get around the need to exit back to the user privilege mode, you can use the do command followed by any privilege exec mode command to execute it from any mode you are. For example, the do show terminal command at the configuration mode will execute the show terminal command as if you were in the privilege exec mode. The example below shows what happens when the command is executed with and without do:

Router(config)#show terminal                   ^
% Invalid input detected at ‘^’ marker.
Router(config)#do show terminalLine 194, Location: “”, Type: “XTERM-COLOR”
Length: 45 lines, Width: 202 columns
Baud rate (TX/RX) is 9600/9600
Status: PSI Enabled, Ready, Active, No Exit Banner, Automore On
Capabilities: none
Modem state: Ready
Special Chars: Escape  Hold  Stop  Start  Disconnect  Activation
^^x    none   –     –       none
Timeouts:      Idle EXEC    Idle Session   Modem Answer  Session   Dispatch
00:10:00        never                        none     not set
Idle Session Disconnect Warning
never
Login-sequence User Response
00:00:30
Autoselect Initial Wait
not set
Modem type is unknown.
Session limit is not set.
Time since activation: 00:00:14
Editing is enabled.
History is enabled, history size is 20.
DNS resolution in show commands is enabled
Full user help is disabled
Allowed input transports are pad telnet rlogin lapb-ta mop v120 ssh.
Allowed output transports are pad telnet rlogin lapb-ta mop v120 ssh.
Preferred transport is telnet.
No output characters are padded
No special data dispatching characters
In the above output, notice that the first command generated an error.  But when it was executed with a preceding do command, it was executed.
3-1 Introduction to Cisco Routers, Switches, IOS & the Boot Process

3-1 Introduction to Cisco Routers, Switches, IOS & the Boot Process

3-1 Introduction to Cisco Routers, Switches, IOS & the Boot Process


The previous two chapters helped you learn the basics of networking. You are aware of various layers of the OSI and TCP/IP models and the devices that work on these layers, especially routers and switches. The rest of the book focuses on various functions of Cisco routers and switches. So before moving to the various functions, it is necessary to know what makes them tick. This chapter is dedicated to Cisco Internetwork Operating System (IOS). Cisco IOS is a proprietary operating system that Cisco routers and switches run on. This chapter looks at the boot process, connectivity options, ways to configure the devices and show basic configuration and verification commands.
Cisco Integrated Services Router (ISR)
Cisco provides various series and models of routers geared towards different types of customer and requirements. Some of them just do routing whereas others provide some other functions such as Wireless connectivity, Security features and Voice-over-IP services. Cisco’s ISR series routers are example of routers that provide various services.
The earlier CCNA exams used to focus on Cisco 2500 and 2600 routers that have been replaced by ISR 1800 and 2800/2900 series routers. 2500 and 2600 routers are End-of-Life now and cannot be bought from Cisco anymore. Figure 3-1 shows a part of the backplane of a Cisco 1841 router with important parts labeled. These parts are described in Table 3-1. Figure 3-2 shows the front panel of the router.
Exam Alert: CCNA is not a device specific exam. You can practice using a 2500 or 2600 router or even a 3800 series ISR router. Every command and concept discussed in this book holds true for all of these routers. The only difference that you need to be aware of is the output difference in memory, interface type (Ethernet or FastEthernet) and number of interfaces
Figure 3-1 Rear view of a Cisco1800 Series ISR
1
Figure 3-2 Front of a Cisco1800 Series ISR
2
Table 3-1 Rear components of the router
Backplane componentDescription and Usage
FastEthernet InterfacesThese are FastEthernet interfaces used to connect the router to the network. Different routers have different number of interfaces. Most of them have slots which allows you to add a module containing more interfaces. Apart from Fastethernet interfaces, a router can have serial interfaces (for WAN connection), an ADSL interface and many other interfaces. Some of these are discussed later in the book while most of beyond the scope of CCNA.
Console PortThis port used to connect to the router to configure, monitor and troubleshoot. More on connecting to the router is discussed shortly.
Slot for ModulesSome routers have slots where additional modules can be added. These modules usually add interfaces to the router.
Power SwitchTo switch on or off the router
AC Power InputTo provide power supply to the router.

Cisco Catalyst Switches
Cisco provides a wide range of switches under its Catalyst brand. The Catalyst brand encompasses many series of switches with each series targeting a particular part or size of a network. The CCNA exam focuses on the 2960 series of switches in the Catalyst brand. 2960 switches are low-cost wiring closet switches that you would expect to be used at the Access layer (remember the Cisco Hierarchical model) for providing network connectivity to hosts.
Exam Alert: As with routers, you can use any switch model as long as it runs IOS when studying for your CCNA exam. I suggest practicing with either a 2950 or a 2960 switch. If your budget can afford one, a 3550 or 3560 Layer 3 switch can be used with its enhancements.  But stay away from the 4000 or 6000 series switches.
Each model in the 2960 series switch is different in terms of the number of physical network interfaces it has but overall each model looks similar. Figure 3-3 shows the front faceplate of the switch. The back of the switch only consists of the AC power input.
Table 3-2 describes the important components shown in Figure 3-3.
Figure 3-3 Front plane of a Cisco Catalyst 2960 Switch
3
Table 3-2 Backplane components of a router
Backplane componentDescription and Usage
FastEthernet InterfacesThese are FastEthernet interfaces used to connect the hosts to the network. Different models have different number of interfaces. Some high end switches can have hundreds of these interfaces.
Console PortIt is a port used to connect to the switch to configure, monitor and troubleshoot. More on connecting to the switch is discussed shortly.
Status LEDsThese LEDs show the status of various components of the switch. Apart from these, there is a LED over each interface showing the status of that interface. Each LED can be either off, amber or green.

Cisco Internetwork Operating System (IOS)
Cisco IOS (different from Apple’s iOS) is a proprietary kernel which controls all functions of a Cisco router and most switches. Cisco IOS is based on the operating system created by William Yeager at Stanford University between 1980 and 1986. Cisco licensed Yeager’s work and created the IOS out of it. The Cisco kernel allocates resources and manages things such as low-level hardware interfaces and security.
Some important items that the Cisco router IOS is responsible for include:
  • Carrying network protocols and functions
  • Connecting high-speed traffic between devices
  • Adding security to control access and stop unauthorized network use
  • Providing scalability for ease of network growth and redundancy
  • Supplying network reliability for connecting to network resources
Apart from the routing, switching, telecommunications and security functions, the IOS also provides a Command Line Interface (CLI) for configuration, management, monitoring and troubleshooting. The CLI can be access using the console port, the auxiliary port (if it is available) and Telnet or SSH. Telnet or SSH access requires IP connectivity, hence the initial configuration requires you to access the device using the console port.
The rest of the chapter is dedicated to connecting to the CLI and basic configuration.
Connecting to the CLI using Console port
To get to the CLI of Cisco router or switch you will need to connect your PC to the console port of the device.  The console port on a Cisco router or switch is a RJ45 port. You need to use a UTP rollover cable (discussed in Chapter 1) with RJ45 connector on one end to insert into the router or switch’s console port and there will be a 9 pin serial connection on the other end which you will plug into a 9 pin serial port on your computer.  Cisco ships a blue console cable with almost every device.  *Note:  Many computers today do not come with a 9 pin serial port so you will need to purchase a 9 pin serial to USB converter and put this on the end of your Cisco console kit so you can make the physical connection.
Connect the serial connector end to the serial port of your PC and the RJ45 connector to the console port of the router or switch. After the physical connection, you will need to use software known as a Terminal Emulator to connect to the CLI. HyperTerminal is an example of a Terminal Emulator that comes pre-installed on some Windows systems. If you do not have HyperTerminal on your Windows PC, you may want to download PuTTY which is a free terminal emulator.  Minicom is a free terminal emulator for Unix based operating systems.
Figure 3-4 Hyperterminal configuration to connect to IOS CLI
 4
Launch your terminal emulator and configure it to connect to the serial interface using the following settings:
  • 9600 bits/second
  • 8 data bits
  • Parity None
  • 1 stop bit
  • No flow control
Figure 3-4 shows Hyperterminal configured to use the above settings.
Booting Up a Router or a Switch
When you power up a Cisco router or a switch, it first runs the Power-On Self-Test (POST). After POST the device looks for and loads the Cisco IOS from flash memory. Flash memory is an Electronically Erasable Programmable Read-Only Memory (EEPROM). When the IOS loads, it looks for the configuration file in the non-volatile RAM or NVRAM. Take a look at the booting process of a Cisco Router shown below. The following output is from an 1841 router.
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)Technical Support: http://www.cisco.com/techsupportCopyright (c) 2004 by cisco Systems, Inc.PLD version 0x10GIO ASIC version 0x127c1841 processor with 131072 Kbytes of main memoryMain memory is configured to 64 bit mode with parity disabled
The first part above shows information regarding the bootstrap program that runs the POST and then tells the router to load IOS. By default the location of the IOS is the flash memory. The next part shows the IOS image being decompressed. The pound sign shows the progress of the decompression process.
[output truncated]
Self decompressing the image : ########################## [OK]
After decompression, the IOS is loaded in the RAM and starts to run. During the startup a lot of information is shown. In the output below notice the IOS version shown as 12.4(25e).
[output truncated]Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), Version 12.4(25e), RELEASE SOFTWARE (fc2)Technical Support: http://www.cisco.com/techsupportCopyright (c) 1986-2011 by Cisco Systems, Inc.Compiled Wed 16-Mar-11 14:42 by prod_rel_team
Once IOS has completely loaded, it will display important information about the router that was learned during POST and booting. You can see the make of the router, the flash and RAM size as well as various interfaces and modules connected as you can see below:
[output truncated]Cisco 1841 (revision 5.0) with 115712K/15360K bytes of memory.Processor board ID FRT072158RA2 FastEthernet interfaces1 Virtual Private Network (VPN) ModuleDRAM configuration is 64 bits wide with parity disabled.191K bytes of NVRAM.31360K bytes of ATA CompactFlash (Read/Write)
The output above shows that the 1841 Cisco router has a total memory of 128MB RAM, 191KB of NVRAM and 32MB of Flash. It also has 2 FastEthernet Interfaces.
Once IOS is loaded, it will copy the saved configuration, called the startup config, from the NVRAM into the RAM. This copy is known as the running config.
Exam Alert: The boot up sequence and type of messages will be similar across all routers. The only noticeable differences will the reported size of RAM, NVRAM, flash and the number/type of interfaces.  Expect to see this type of output in your CCNA simulation exam questions.
The boot process of a Cisco catalyst switch is similar. The following outputs show the messages that appear when a 2950 switch is booted up.
C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1)Compiled Mon 22-Jul-02 17:18 by antoninoWS-C2950G-24-EI starting…
The above message shows the bootstrap program running. The output below shows the IOS being decompressed and then loaded into the RAM.
[output truncated]
Loading “flash:/c2950-i6q4l2-mz.121-22.EA6.bin”…################################
File “flash:/c2950-i6q4l2-mz.121-22.EA6.bin” uncompressed and installed, entry point: 0x80010000
executing…
After the IOS is decompressed, the IOS version is displayed. Note the version displayed below is 12.1(22)EA6.
[output truncated]Cisco Internetwork Operating System SoftwareIOS ™ C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA6, RELEASE SOFTWARE (fc1)Copyright (c) 1986-2005 by cisco Systems, Inc.Compiled Fri 21-Oct-05 01:59 by yenanh
After IOS loads, it runs POST on various components of the switch as can be seen below.
[output truncated]POST: System Board Test : PassedPOST: Ethernet Controller Test : PassedASIC Initialization PassedPOST: FRONT-END LOOPBACK TEST : Passed
After the last POST is passed IOS completes loading and displays the information learned during the POST. The output is similar to the one displayed when the router completes booting and provides information regarding the device.
cisco WS-C2950G-24-EI (RC32300) processor (revision L0) with 21013K bytes of memory.Processor board ID FOC1028Y1TALast reset from system-resetRunning Enhanced Image24 FastEthernet/IEEE 802.3 interface(s)2 Gigabit Ethernet/IEEE 802.3 interface(s)32K bytes of flash-simulated non-volatile configuration memory.[output truncated]
The output above shows that the 2950 switch has 20MB of RAM and 32KB of flash. There are 24 FastEthernet interfaces and 2 Gigabit Ethernet Interfaces in the switch. Just as in the case of the Router, once IOS has loaded, it will copy the startup config into the RAM as running config.
In both, the case of the router as well as the switch, if startup config is not present, the device will go into the setup mode and start the System Configuration dialog. This is a step-by-step process to help you with basic configuration. You can tell that the device has gone into the setup mode if you see the following output after IOS loads:
         — System Configuration Dialog —Would you like to enter the initial configuration dialog? [yes/no]:% Please answer ‘yes’ or ‘no’.
You will not be going through the setup mode since CCNA is all about configuring the switches and the routers using the CLI.
Table 3-3 sums up all the components and their functions that you learned about in this section.
Figure 3-3 Important components used during boot
ComponentFunction
BootstrapA small program that runs the POST test and then loads the IOS on bootup.
Flash MemoryAn EEPROM where the IOS file is stored. The bootstrap looks for the IOS file here first.
RAMThe working memory of the device. A copy of the configuration is also stored here after bootup.
NVRAMNon-volatile RAM it stores a copy of the configuration. On bootup, IOS reads the configuration file from here.
Note: The rest of the chapter is dedicated to basic configuration using the CLI and the commands and concepts apply to both a router and a switch, unless specifically mentioned otherwise.  The CCNA exam only uses the CLI and no GUI at this time.