Command Line Interface (CLI)

The Command Line Interface (CLI) is used as an interface to your Network equipment such as Routers and Switches. CLI on Packet Tracer;

CLI on Packet Tracer

Accessing the CLI

A Terminal Emulator such as Putty can be used to access the CLI.

This can be achieved a number of different ways; one way is to physically connect your PC to the relevant Network device using a crossover cable. Have a look at how to this step by step here
This image has an empty alt attribute; its file name is console-cable.jpg
This image has an empty alt attribute; its file name is switch-rollover-1.jpg

The other way to access the CLI is to connect to your Network Device remotely using Telnet or SSH. SSH is a more secure version of Telnet.

CLI Modes

  • You must type the right commands in the right modes
  • Commands that work in config mode will not work in user mode etc

User Mode    

User mode is the first mode you encounter when you access the device.

Router>

User mode is read only so doesn’t allow you make any changes to any device configuration.

User Mode >

Enable/Privileged Mode      

Enable mode (or privileged mode) is accessed by typing the enable command in user mode

Router# indicates you are in Enable/Privileged mode

Enable mode gives more command choices and allows you go to navigate to other modes. You have the option to password protect enable mode (more on this soon).

Disable Command

To return to User Mode from Enable/Privilaged mode type

disable

Global Configuration mode    

Global Configuration mode allows you to make changes to the devices system configuration. The commands available will depend on what type of interface you are configuring.

To enter Global Configuration mode type the command conf t in enable mode;

While we are in Global Config mode we will take the opportunity to set up an enable mode password.

You will be prompted for this password when moving from User mode into Enable mode

Other Modes:

Interface Mode

Interface mode allows you to configure a particular interface on the Router or Switch etc. In the following example I access interface Gi0/0/1 in order to configure an IP Address and sub net mask.

Interface Mode

Line Mode

Line mode is accessed from Global Config mode and is used to connect via Telnet and SSH. In the following example I wll set up a telnet connection on the Router by typing the command line vty 0 4 followed by the command login . Finally we set a line password, in this case cisco by typing the command password cisco . We then exit back to Global Config mode.

Putting it all together

So far I have shown you snippets of commands but lets now look at putting it into a bit more context.

I will use the example of configuring two Cisco Routers with IP Addresses and Telnet. I will then Telnet from Router 1 to Router 2 via Router 1’s Command Line Interface.

Two Routers connected via Ethernet Cable

Start and Running Configuration.

Start Config

Start Config is the configuration of the device when it starts up. After start up you begin working in running configuration.

Running Config

Is the real time configuration of the router/switch. This information is in RAM so it is not saved for use the next time you start up unless you save the configuration to Start Config.

Any changes made in running configuration will not be reflected in the start up configuration unless you save it. Start Config is NVRAM which is more permanent memory.

Think of it as opening an MS Word document (Start Config). You begin typing in the document (Running Config). If you need to save your work from Running Config to Start Config otherwise your work will be lost.

The official way to do this for the Cisco exam is by typing;

Copy running-config startup-config

Copying run config to start config

TFTP Backup

You can copy your configurations to TFTP using the following commands:

  • Copyruntftp: (this is a merge)
  • Copystarttftp: (this is a replacement)

Conclusion

So there we have a brief overview of the Command Line Interface (CLI). Below I have written a short summary of the different command modes.

Modes

  • User mode
  • Privileged mode
  • Global configuration mode

User Mode

  • This has a prompt of >
  • Example; Router>
  • User mode is only used for a limited amount of monitoring commands
  • To change to Privileged Mode
  • Type enable
  • Example; Router> enable
  • This will change the prompt to #
  • Example; Router#
  • You can use show command to see different things
  • Show version etc
  • Or type show? To see what options are available to show

Privileged/Enable mode

  • Type enable in User mode
  • The prompt for Privileged mode is #
  • Router#
  • Enable mode allows many more show commands
  • Can be used for debugging
  • Used for configuring the device
  • You can only go to Global Configuration Mode via enable mode
  • Type; Conf t to get to global configuration mode
  • Control z will bring you back to enable mode

Global Configuration mode

  • (config)#
  • Example; Router(config)#
  • Used for configuring the router, like changing its name and setting banner of the day etc

Interface mode

  • Router(config-if)#
  • Allows you change the configuration of an individual interface
  • i.e the IP address of a routers Fast Ethernet 0/0 interface
  • or enable or disable the interface
  • Ethernet would have different commands than a serial interface

Copying Running Config to Start Config

You should save your configuration, particularly in the exam unless told not to.

  • Copy running-config startup-config