All the Cisco hardware comes with an operating system called Internetwork Operating System (IOS). Besides controlling the performance and behaviour of the devices, it contains an interface for humans called the command line interface (CLI). It accepts text-based commands from the user and when you press enter, the device processes the command. We can access the CLI from the console, and even from a remote location using telnet and SSH.
When we access the CLI it puts us in user EXEC mode, commonly called user mode (switch>). In this mode, we can look around but not break anything. We can use connect, copy, ping, show, enable, telnet, etc., commands in the user mode. The most powerful command of the CLI is the enable command. It puts the user in the enable mode or privileged mode (switch#). In addition to the user-mode commands, we can use reload, ssh, configure,etc., commands in this mode. The second most common command used on CLI is the configure terminal command. This command puts us in global configuration mode [switch(config)#]. To configure a particular interface of the device, we enter the interface configuration mode [switch(config-if)#], by using switch(config)#interface interface identification command. We can also enter a vlan configuration [switch(config-vlan)#] by using switch(config)#vlan vlan-id command. The copy command is also very useful in copying the running configuration to the start-up configuration, by using switch#copy running-config startup-config command or vice versa by using switch#copy startup-config running-config command. We can use enable password or enable secret commands to set passwords on the console.
The show commands are also very handy while using CLI and help us to verify the configurations. We can use show commands in both the user mode and the privileged mode. A few examples of show command are – show run, show ip, show ip route, show interfaces, show ip interface [brief], show access-lists. The most common and important command while working on a router interface is no shutdown command. This command makes sure that the interface is up/enabled. To assign an IP address to an interface we can use DHCP or we can manually configure the interface using the router(config-if)#ip address ip-address subnet-mask command in the interface configuration mode. To enable routing on a router we can use either static routing or dynamic routing. For configuring static routing, we use router(config)#ip route network-address subnet-mask next-hop-address [outgoing interface] command in the global configuration mode. For dynamic routing, let’s say using OSPF, we use a series of commands – router(congif)# router ospf process-id → router(config-router)# router-id router-id → router(config-router)#network network wildcard mask area area-number. In the end, to exit a mode we use either exit, end, or ctrl+z, depending upon the mode we were in.
To learn Cisco Certification