Once, you have connected to your terminal to Cisco switch or router console port power it up and observe startup messages on your screen.
In case your network device does not have startup-configuration saved in NVRAM/Flash memory, you will be greeted with 'Would you like to enter the initial configuration dialog [yes/no]:' message as depicted below:
Pic. 1 - System Configuration Dialog
You can safely cancel this request as its capability to configure the device is not very impressive. Just enter: no and hit enter twice. Wait, as it takes few seconds for the device to give you prompt back.
What follows is bunch of messages sent to the screen and after hitting the Enter key few times you get something like this (here is the router, but a switch would introduce itself as ... Switch> ):
Router>
What you are looking at right now is prompt of IOS operating system. Terminal and commands you type are the primary means of 'talking' (configuring/monitoring) your network node (switch/router).
IOS Modes (contexts)
From the very beginning try to be attentive to details you see on the screen.
The prompt of the device tells you which 'context' you are in.
The prompt that presents '>' character is called '
user exec mode' or '
privilege level 1 mode'. You can't configure much in this mode of operation. It is designed as a 'monitoring' mode not a 'configuration' one. You should also know that even monitoring capability in user exec mode is limited. For instance, you can't see the running configuration of the device. However, it is useful for less experienced users who want to perform basic diagnostics of the device without risking of accidental re-configuring the device and causing a problem.
Make sure that if you are learning networking you DO NOT USE PRODUCTION equipment. You should have some lab gear to experiment on.
Assuming you are using lab equipment let's roll up our sleeves and begin to learn about different IOS contexts.
Type in the following command:
Router>enable
Router#
The prompt changes to '#' which is called '
privileged exec mode', '
enabled mode' or sometimes '
privilege level 15 mode'. I would like to draw your attention to two things here. Both modes of operation (or contexts, if you like) have two things in common:
- They are used primarily to monitor the device (you will be using 'show' and 'debug' commands in those modes).
- Using any IOS command and pressing enter will execute the command as long as its syntax is correct. In case you make a typo or command is not available in the context you are in, an error shows up on the screen and the command will not be executed.
NOTICE!
IOS takes a single command per line that must be accepted with Enter.
Now, coming back to those two modes (contexts) here's a somewhat concise explanation of what they are used for and how to use them:
- User Exec Mode - is limited in terms of what information will be available.
- Enabled Exec Mode - gives the operator ALL information (like root or Administrator account on a computer).
Question Mark
IOS commands (one per line) can be a single keyword or a keyword followed by one or more arguments. You should learn how to ask IOS for help as there will be a lot of commands to remember and a lot of arguments those commands can take.
Question mark '
?' is your best friend in learning commands. It is a built-in help that is a '
context-sensitive help'. This means that depending on which context you use, typing a question mark (
?) will display only keywords (commands) available in this particular context.
Configurations
In order to configure things in Cisco IOS (except for some minor changes), you must enter the '
global configuration mode' first which is characterized by the following prompt:
Router(config)#
This context can be accessed by typing the following command in the '
privileged exec mode':
Router#configure terminal
Whatever you configure device in 'global configuration mode' or 'config mode' it is going to be applied to the device
as a whole unit (e.g. hostname, default gateway on a switch etc.). Don't worry about details right now. I will explain them in due time.
If you want to enter the context of the interface to add some parameters to it such as ip address, speed, duplex, description etc. , you must enter that interface from the global configuration mode like the one below:
Router(config)#interface fastethernet0/1
REMEMBER!
Watch your prompt to know in which context your cursor is. If a particular command does not work it is either a typo, or perhaps you are in the wrong mode of operation (wrong context).
If you do not know what interfaces your device has, type the following command in the enabled mode:
Router#show ip interface brief
Here's first 'gotcha'. All 'show' commands can only by typed in either user-exec mode or privileged-exec mode. If you are in the 'config' mode you must precede show command with the 'do' keyword as shown below:
Router(config)#do show ip interface brief
Now look at the whole navigation I just showed here:
Router>enable
Router#configure terminal
Router(config)#interface fastethernet0/1
Router(config-if)#do show ip interface brief
- Entered the interface type (here: Fast Ethernet).
- Referenced the module number (here: 0)
- Referenced the port number in the module 0 (here: 1)
Please, note that routers count ports starting from 0, switches start counting ports from 1.
You'll learn other contexts as we go through numerous labs.
Abbreviations
You don't have to type in the full words of the commands and certain attributes that follow the commands. For instance, instead of typing:
Router#configure terminal
Router(config)#
You can type:
Router#conf t
Router(config)#
As long as the abbreviation uniquely describes which command you want to use, the system has no problem accepting it.
Shortcuts And Keystrokes
When you type enough of the characters that uniquely identify the command in a given context you can use '
tab' key and the system is going to complete the command on the screen (just like it happens in Linux terminal).
I often use the following keystrokes while editing the commands:
- CTRL-z - takes the cursor back to the 'enabled exec' mode from any other context (Router#)
- CTRL-a - takes the cursor to the beginning of the line
- CTRL-e - takes the cursor to the end of the line
- CTRL-k - erases everything to the right of the cursor
- CTRL-u - erases everything to the left of the cursor
- Up Arrow or CTRL-P - displays previous command from the history buffer
- Down Arrow or CTRL-N - displays next command from the history buffer
System keeps the record of up to ten or twenty (default) commands you typed in. That depends on the system you use. You can increase/decrease the history buffer up to 256 commands.
If you want to check the history buffer size, type in:
Router#show terminal | include history
I will describe this pipe character '|' and 'include' keyword in our practice lab later.
Changing the buffer size can be accomplished with the following command in the 'enabled mode'
Router#terminal history size 256
There is another way of doing it, that you will practice in our lab section.
The above command will increase the size of the history buffer to 256 commands.
If you want to see the buffer (which commands were typed) use this command:
Router#show history
If you understand the content of this lesson, let's practice all you have read (and a bit more) in our first lab.