Command Line Interface
First we will understand what is CLI?
CLI is a command line interface that network engineers use to configure a device. CLI is also known as user interface because to control device hardware the user type commands in CLI.
There are 3 modes in the CLI-
1. User mode (User Exec mode): When user access the CLI, first place in user mode. You can’t configure any command here. This mode is only for some basic monitoring. Use enable command to move next mode (privileged mode) .
2. Enable mode (Privileged Exec mode / Privileged mode): You can’t configure any command here. This mode allows you to monitor the configuration by using show commands. Show commands are very useful in troubleshooting. You can run reload command in this mode to reboot the device.
Some basic show commands which are commonly used:
Router # show running-config
Router # show startup-config
Router # show ip route brief
Router #show ip interface brief
Router # configure terminal (to enter into global configuration mode)
3. Global Configuration mode: All configuration are done in this mode. You can also run enable mode commands here, by putting do in the starting of command. For example- show ip interface brief (in enable mode)
do show ip interface brief (in global configuration mode)
Some basic commands to navigate between different modes.
Enable command is used to enter into privileged mode from user mode.
Configure terminal command is used to enter into global configuration mode from privileged mode.
Exit command is used to come out from a mode.
When user access the CLI, the first mode in which user enter is user mode.
It shows like
Now if you type enable command (after typing command please hit enter button), you enter in enable (privileged mode).
It shows like
Now if you type configure terminal command, you enter in global configuration.
It shows like
Switch# configure terminal
Switch (config) #
Detail Explanation with example:
###### Switch CLI #######
Switch> —————————user mode
Switch (config)# ——————global configuration mode
######## Router CLI ######
Router #———————————–privileged mode
Router # configure terminal
Router (configure)#————————global configuration mode.
When you access CLI, user places in the user mode. Type enable command and hit enter button. Now you will jump into privileged mode from user mode. You can’t directly access the global configuration mode from user mode. It is step-by-step process. First user enters in privileged mode, after then user enters in global configuration mode.
Different Methods to access CLI
Same like other computer hardware, Cisco hardware have an operating system that is called as Internetwork Operating System (IOS). So, from now whenever you heard a word Cisco IOS, then you will know the person is talking about operating system of a Cisco device.
There are 3 different methods to access CLI
1. By using console
2. By using Telnet (port no. 23)
3. SSH (port no. 22)
Now, we will discuss every method in detail, on the completion of explanation, you will be able to know when to use which method.
By using console: In this method, device is approachable ( user and device both are at same location). We simply go near to the device.
There is a console port on the device; console port is especially designed to provide access to the CLI.
Let suppose we have to access the CLI of a switch by using console port. So, in this method, first we need a switch, a laptop and a rollover cable. Now connect one end of cable to the switch console port (RJ-45 connector). Connect the other end of the rollover cable to serial or USB port of your PC.
By using SSH and Telnet: SSH (secure shell) and telnet both are used to remotely login a device.
The only difference SSH is more secure than Telnet. Telnet sends all data including username and password in plain text while SSH encrypts all data including login credentials.
We use these methods when user and device both are on different location.
After connection, you need terminal emulator software (putty or some other) that must be installed on your PC. Terminal emulator accepts the data as text which user type in CLI and then send the commands to the switch over the console or IP networks. It works like a translator between switch and user.
The emulator must be configured to match the parameters of PC’s serial port to switch console port.
· 9600 bits/second
· No hardware flow control
· 8-bit ASCII
· No parity bits
· 1 stop bit
The last 3 parameters collectively known as 8N1.