In order to benefit from this lab, please get familiar with the lesson first. In order to do it click the link Back to Lesson.
First connect your terminal software to a switch or router, power up the bad boy and hit enter. I am going to connect to my switch and let's fool around a bit with it. After the boot (a lot of messages flying out on your screen) you should have terminal access to your device.
If your device (like mine) has no startup configuration (more on that later) you will see something similar to this:
If that is the case please type no and hit enter to ignore this proposition.
You should see the prompt indicating that you are in 'user exec mode'.
Switch>
Use User Exec Mode Context Sensitive Help.
Type in question mark to see the available commands (keywords) in user exec mode. Your output might be different from mine. Commands in the first column on the left hand side of the screen will vary based on the type of your device (switch or router) platform (series) and version of IOS.
Here's my output (click the picture to enlarge it, ESC to exit the picture):
Commands (keywords) are always listed on the left. Next to each keyword you will see a brief explanation what a particular command does. At this stage don't try to learn them all. You will get familiar with the commands as soon as you start configuring various technologies. Now, just take a quick look at the layout.
Notice the
-- More -- at the bottom of the page. This aptly indicates that there are more commands to be displayed but they did not fit on the screen.
Press Enter, to scroll down line by line. Press space bar to scroll down page by page. If output is long, you can stop and get your prompt back using 'q' letter.
REMEMBER
- Display has paging enabled by default
- Enter key scrolls down line by line
- Space bar key scrolls down page by page
- Letter q stops terminates display and gives the prompt back
Check Your Privilege Level
Type in
show privilege level and execute it by pressing Enter key. Example below should help you:
Switch>show privilege
Current privilege level is 1
Switch>
REMEMBER
- Each command is a one line command followed by enter key
- Privilege level 1 is user exec mode. This mode is used for monitoring and is restricted (many commands are not accessible).
Enter Privileged Exec Mode
Switch>enable
Switch#
Pay a close attention to the prompt. It changed from > to #.
Check Your Privilege Level
Switch#show privilege
Current privilege level is 15
Switch#
REMEMBER
Privilege level 15 is called 'privileged mode' or 'enabled mode'. This mode allows user to access ALL show and debug commands (more on these in later lessons). This means that the user has unrestricted access to the device. It also allows the user to enter 'global config mode'. This privilege level is a synonym to administrator in Windows or root in Linux operating systems.
Enter Global Configuration Mode
Follow the example below. Type
show privilege and accept the command by pressing Enter key.
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
REMEMBER
Global Configuration Mode has typically larger number of commands. In this mode we configure features that will have a global scope (will apply to the device as a whole).
Configure Hostname
It is time to configure something useful. Let's start with naming our device. My switch is going to be called
SW4. You can name yours whatever you like. Here's how we do it. Use
hostname command followed by your name choice and enter:
Switch(config)#hostname SW4
SW4(config)#
Notice, that the hostname shows up immediately in the prompt.
REMEMBER
As soon as you accept the command with enter key the command is being executed in RAM memory immediately. Of course, as long as syntax is correct. System does not check the logic of what you do, only syntax (there are few exceptions but that is a general rule).
Check What Interfaces Your Device Has
In order to do that let's use
show ip interface brief command. Now, if you remember from Lesson 2,
show commands cannot be used in any configuration mode unless preceded with
do command. Follow the example below (don't forget to hit enter key to execute the command):
Hint: If you use switch you can also try do show interface status command followed by enter
SW4(config)#do show ip interface brief
I will use the first interface on my device that is Ethernet0/0. You should the interface that is on your lab equipment.
Enter a Configuration of an Interface
SW4(config)#interface ethernet0/0
SW4(config-if)#
Notice the prompt! It shows that you are in the configuration mode of the interface you have entered. In my case it is ethernet0/0 (type: ethernet, module 0, port 0 respectively).
Configure Interface Description
SW4(config-if)#description *** UNUSED ***
SW4(config-if)#
Exit Configuration Interface (Back to Config Mode)
SW4(config-if)#exit
SW4(config)#
Exit Global Config Mode (Back to Privileged Exec Mode)
SW4(config)#exit
SW4#
REMEMBER
The exit keyword takes you one step down in the hierarchy of IOS modes of operation.
Check Terminal History Size
Your device will remember a number of recently used commands (that includes your typos). This buffer size can be changed.
SW4#show terminal
Look at my output below. Locate the line that reads:
History is enabled, history size is 20.
Your output might say size is 10 instead of 20
Change History Buffer to 256 Commands
SW4#terminal history size 256
SW4#
Check History Buffer After Change
SW4#show terminal | include history
History is enabled, history size is 256.
SW4#
Notice that this time, I used a pipe sign
| followed by
include history.
Let's see what options my device has when used with pipe character:
You don't have to learn them all now, but remember at least four of them (if you don't see section that is fine, not all devices have it).
REMEMBER
Useful pipe options (matching words is case sensitive):
- begin
- include
- exclude
- section
If you still don't know how to use them, don't worry. You will be using them with me very soon and you will learn how useful they are very soon.
IOS has many features in relation to navigation like shortcuts (CTRL-a, CTRL-e, etc.). You can read about them in lesson 2. Now I would like you to practice at least four of them that I find extremely useful. Follow this step. Notice exclamation mark at the beginning of the sentence. It is like comment. If you precede something with an
! mark, hitting enter will not produce an error. It will not be executed at all.
Write A Long Sentence Using Prompt (DO NOT HIT ENTER THIS TIME)
If you type in a long sentence it will not fit into the screen. Thenat the beginning of the line a dollar sign shows indicating that there is more stuff that is being truncated (invisible).
Now, use the following sequence and each time observer what happened to your cursor:
CTRL-a (cursor jumps to the left hand side; beginning of the line)
CTRL-e (cursor jumps to far right; end of the line
Now using left arrow move the cursor to the middle of your sentence and press another two shortcuts in turn:
CTRL-k (everything to the right of the cursor is erased)
CTRL-u (everything to the left of the cursor is erased)
Great stuff. Give yourself a break before commencing to your homework.
REMEMBER
You do not have to use full words to use the commands. You do not even have to use tab to auto complete them. For instance, instead of:
configure terminal
I can use
conf t
See what I did below. Try to repeat it, but check what happened each step of the way.
Two more things before we call it a day. Your configuration (hostname, interface description) is kept in the RAM memory. This means that after reboot, it will be gone. In order to save your work, you must use
copy running-configuration or older command
write memory. You can abbreviate them to
copy run start, or
wr, respectively.
In order to display running configuration use
show running-config or
show run. In order to see the configuration you saved in NVRAM/FLASH, use
show startup-configuration or
show startup.
I hope you enjoyed the lab and feel excited to see another one. See you soon.