Cisco IOS is the operating system on Cisco switches and routers. It uses command modes, and each mode allows different commands. Knowing where you are is the first CLI skill.
The three main modes
The prompt tells you the mode:
- User EXEC mode:
Router>gives limited, mostly view-only commands. - Privileged EXEC mode:
Router#gives full view commands and can save or reload. Enter withenable. - Global configuration mode:
Router(config)#is where you change the device’s settings. Enter withconfigure terminal.
Router> enable
Router# configure terminal
Router(config)# hostname LabRouter
LabRouter(config)#
Use exit to go back one level, and end (or Ctrl+Z) to jump straight back to privileged mode. disable returns from privileged to user mode.
Sub-configuration modes
From global config you enter more specific modes, shown in the prompt:
interface gigabitEthernet 0/0givesRouter(config-if)#line console 0givesRouter(config-line)#vlan 10givesSwitch(config-vlan)#router ospf 1givesRouter(config-router)#
Always check the prompt before typing a command. A command typed in the wrong mode either fails or changes the wrong thing.
Helpful CLI habits
- Tab completes a command, and commands can be abbreviated (
conf tworks forconfigure terminal). - ? shows available commands or options:
show ?lists everything aftershow. - Up arrow recalls previous commands.
- no in front of a command undoes it, such as
no shutdown. - A message like
% Invalid input detectedwith a caret points to where the typo is.
Securing the modes
On your own practice device, protect privileged mode so not everyone can reach it:
Router(config)# enable secret StrongLabPass123
Router(config)# service password-encryption
enable secret stores a hashed password and is preferred over the older enable password, which is weakly protected. Remember that configuration changes live in the running config and are lost on reload unless you save:
Router# copy running-config startup-config
Check your understanding
1. Which prompt shows privileged EXEC mode?
- Router>
- Router#
- Router(config)#
- Router(config-if)#
Answer: Router#. The pound sign indicates privileged EXEC mode.
2. Which command moves from privileged EXEC to global configuration?
- enable
- configure terminal
- config mode
- interface
Answer: configure terminal. It opens global configuration mode, shown as (config)#.
3. Which command returns you directly to privileged EXEC from any config mode?
- exit
- disable
- end
- quit
Answer: end. It jumps straight back to privileged EXEC, while exit goes up one level.
4. Which is better for protecting privileged mode?
- enable password
- enable secret
- Leaving it blank
- Writing it on the device
Answer: enable secret. It stores a hashed value instead of an easily reversed one.
