Monday, December 17, 2012

Start working with Cisco Internetwork Operating System (IOS) command line interface (CLI)

This post will introduce the Cisco Internetwork Operating System (IOS) command line interface (CLI). You will need to login to a router and become familiar with the different levels of access on the router. You will also become familiar with the commands available to you in each mode (user or privileged) and the router help facility, history, and editing features.

Before starting, just have a look at the following simple diagram

It clearly shows that routers connect with each other via serial ports and routers connect with other nodes such as PCs via Ethernet ports.

Modes of a router

there are three modes in a router which are user mode, privilege mode and the configuration mode. you need to know what are the function that could be achieved in each of these modes. get an idea of them from  the below description.

user mode 

User mode is indicated with the ‘>’ next to the router name. You can look at settings but can not make changes from user mode
  • marked as Router > in the CLI.
  • basically used to view the information in the CLI
  • can change terminal settings
  • perform basic tests of the router
  • list system information

privileged mode

In Privilege mode (indicated by the '#') you can do additional tasks than user mode.
  • marked as Router # in the CLI
  • test and debug router operations
  • set operating parameters
  • perform detailed examination of the router

configuration mode

  • modify interface settings
  • perform routing protocol settings ( assigning IP address)

Memory of a router can be categorized as below

  • RAM
saves the running config files
volatile memory

  • ROM
Basic Cisco IOS software

  • flash memory
CISCO IOS software
Flash memory is a special kind of memory on the router that contains the operating system image file(s). Unlike regular router memory, Flash memory continues to maintain the file image even after power is lost.
Router>show flash

System flash directory:
File  Length   Name/status
                                1   5571584  pt1000-i-mz.122-28.bin
[5571584 bytes used, 58444800 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)
  • NVRAM (Non Volatile Random Access memory)
startup configuration

how to switch from,

user mode to privileged mode?   


privileged mode to configuration mode? 

config terminal or config t

configuration mode to privileged mode?

exit or end or ctrl + Z

privileged mode to user mode?


following are some of the useful commands in the CLI. just know them once and you will learn them quickly when practicing some tasks.

How to view all the commands under a specific mode?

Router > show ?   to view all the commands under user mode

How to get HELP?

To view all commands available from this mode, type ‘?’ and press Enter Key. This will give you the list of all available commands for the router in your current mode. You can also use the question mark after you have started typing a command. For example if you want to use a show command but you do not remember which one it is, type ‘show ?’. This will output all commands that you can use with the show command.

How to see the hardware Information of a router?

Router > show version
The 'show version' command gives you a lot more information than at first you may think. Use 'show version' to obtain critical information, such as router platform type, operating system revision, operating system last boot time and file location, amount of memory, number of interfaces, and configuration register.  

How to see the Routing protocols

Router > show protocol
To view the status of any routing protocols currently configured on the router, can use the ‘show protocols’ command. 

How to see the running configuration files ( in RAM)

Router # show running-config
The currently active configuration script running on the router is referred to as the 'running configuration’ on the routers command-line interface. Note the privilege mode required. The running configuration script is not automatically saved on a Cisco router, and will be lost in the event of power failure. The running configuration must be manually saved with the 'copy' command .

How to see the startup configuration files?

Router # show startup-config

How to copy running configuration files to startup configuration files ?

Router # copy running-config startup-config

How to view a Command history?

Router#show history
The routers Command Line Interface (CLI) maintains by default the last 10 commands you have entered in memory, for later retrieval. You can change this default value. You cycle through previous router commands entered (since the last power loss), using one of two methods. To view all of the past commands still in router memory at the same time, use the 'show history' command. For single line retrieval, use either the Arrow-Up (for previous command) and Arrow Down (for next command), or Control-P(for previous command)and Control-N(for next command).  

How to view the Clock?

Router#show clock
The router keeps its own clock that you can use to synchronize devices to. To view the clock use the show clock command.

How to view the Host Table?

Router#show hosts
You can create a list host name on your router. You can view the entries (if any) by typing show hosts.