10: Cisco IOS, The CLI Commands

10.1 CLI (Command Line Interface) modes

The CLI (Command Line Interface) is the software interface that the network admin uses in order to configure the router.

Every CLI mode contains some commands that enable us to configure a certain set of functions on the router.

We can move through different modes using some commands as will be explained in this hour.

10.1.1 Setup mode (initial configuration mode)

This mod contains interactive configuration dialogue that enables us to configure the router.

When the router starts up, it will take the startup configuration from the NVRAM and copy it to the RAM in order to use it.

If the router did not find any startup configuration, it will enter to the ‘setup mode’, and it will ask us if we need to use the initial configuration dialogue in order to configure the router.

It is optional to us to use this dialogue or not.

Image1897.JPGFigure 10.1: the initial configuration dialogue.

If we refused to use this dialogue, the router will enter to the ‘user EXEC mode’.

10.1.2 The ‘user EXEC mode’

In this mode, every line in the CLI starts with the following,

Router>

If a user name and a password are configured on the router, the router will ask us to write them to be able to access the next mode, which is the ‘privileged mode’.

To enter to the ‘privileged mode’, we write the command,

Router> enable

As seen in figure (10.2).

Image1908.JPGFigure 10.2: the user EXEC mode.

10.1.3 The privileged mode

In this mode, every line in the CLI starts with the following,

Router#

This mode contains the basic operation monitoring commands, and it is used to test the network connectivity, and to make a backup and restoration of the router’s configuration and the Cisco IOS.

To enter to the next mode, the ‘global configuration mode’, we write the command,

Router# configure terminal

As seen in figure (10.3).

Image1915.JPGFigure 10.3: the privileged mode.

10.1.4 The global configuration mode

In this mode, every line in the CLI starts with the following,

Router(config)#

This mode contains most of the basic configuration commands.

To enter to one of the next modes like the ‘interface mode’, we write the command,

Router(config)# interface inerface

As seen in figure (10.4).

Image1923.JPGFigure 10.4: the global configuration mode.

10.1.5 Specific configuration modes

They are the modes that contain commands that affect the interfaces or the processes on the router, like the ‘interface mode’ and the ‘router configuration mode’.

10.2 Privileged mode commands, ‘show’ command

10.2.1 The ‘show’ command

The ‘show’ command enables us to view the router’s configuration and operation. Example of the ‘show’ commands,

The ‘show version’ command

Router# show version

5644.jpgFigure 10.5: the ‘show version‘ command.

The ‘show version’ command enables us to view the version of the Cisco IOS that exists on the router, the RAM size, and the interfaces that exist on the router, the NVRAM size, the flash memory size, and the configuration register value.

The ‘show ip interface brief’ command

Router# show ip interface brief

This command enables us to view every router interface status

Image1930.JPGFigure 10.6: the ‘show ip interface brief‘ command.

The ‘show process’ command

Router# show process

It enables us to view every process on the router and the process CPU utilization.

Image1939.JPG

Image1946.JPGFigure 10.6: the ‘show process‘ command.

The ‘show running-config’ command

Router# show running-config

This command shows us the entire running configuration that exists on the RAM.

The ‘show startup-config’ command

Router# show startup-config

This command shows me the entire startup configuration that exists on the NVRAM.

10.2.2 The ‘debug’ command

The ‘debug’ command enables us to view all the packets that exit from and enter to the router.

The ‘debug ip icmp’ command

Router# debug ip icmp

This command enables us to view all the packets that are belonging to the ‘ICMP protocol’.

Image1954.JPGFigure 10.7: the ‘debug ip icmp‘ command.

10.3 Privileged mode commands, network connectivity

Image1962.JPGFigure 10.8: the network connectivity.

10.3.1 The ‘ping’ command

Router# ping ip address

The ‘ping’ command is used to examine the network connectivity problems in a certain network.

In figure (10.8), suppose that we are on ‘computer A’ and needs to make sure that ‘computer A’ is able to reach ‘computer D’.

From ‘computer A’, we make a ‘ping’ to ‘computer D’ (11.0.0.2) as following,

Image1970.JPGFigure 10.9: the ‘ping‘ command.

As seen in figure (10.8), ‘computer A’ sent five echo requests to ‘computer D’, and received five echo replies from ‘computer D’. Which mean that ‘computer A’ is able to reach computer D.

10.3.2 The ‘traceroute’ command

Router# traceroute ip address

The ‘traceroute’ command is used to know the nodes that exist in the path between the source and the destination, and if there is a network connectivity problem, it helps us in determining in which node in the path this problem exists.

In figure (10.8), suppose that we need to know the nodes that exist in the path between ‘router A’ and ‘computer D’.

From ‘router A’ we make a ‘traceroute’ to ‘computer D’ (11.0.0.2) as following,

Image1979.JPGFigure 10.10: the ‘traceroute‘ command.

As you can see in figure (10.10), that data exits from ‘router A’ and passes through (10.0.0.1) which is the ‘R1’. Then, it passes through (50.0.0.2) which is the ‘R2’. Then, is arrives to (11.0.0.2) which is the ‘computer D’.

Suppose that there is a problem in the ‘R2’ connection with ‘computer D’, in this case the data will arrive to (50.0.0.2) which is R2. Then (11.0.0.2) will be marked as ‘unreachable’. Therefore, we can know that the network connectivity problem exists in the connection between the ‘R2’ and the ‘computer D’.

10.4 Privileged mode commands, backing up and restoring processes

Image1990.JPG Figure 10.11:backing up and restoring.

In figure (10.11), the TFTP server is used to back up the Cisco IOS and the router’s configuration, and to retrieve the Cisco IOS and the router’s configuration from it to the router.

We use the ‘copy’ command to copy a file from the router to the TFTP, and vice versa.

10.4.1 Backing up an restoring the Cisco IOS

The ‘copy flash tftp’ command

Router# copy flash tftp

This command is used to make backing up for the router’s Cisco IOS, this is done by taking a copy from the Cisco IOS that exists on the router’s flash memory, and put this copy on the the TFTP server.

When we write this command, the router will ask us for the Cisco IOS’ file name and the TFTP server’s IP address.

The ‘copy tftp flash’ command

Router# copy tftp flash

This command is used to make a restoring for the Cisco IOS from the TFTP server to the router’s flash memory.

This command also can be used if we have a newer Cisco IOS version on the TFTP server, and we need to copy it to the router’s flash memory to replace the older version that exists on the router. This process is called the Cisco IOS upgrading.

10.4.2 Backing up and restoring the router’s configuration

The ‘copy running-config startup-config’ command

Router# copy running-config startup-config

This command is used to copy the running configuration that exists on the RAM to the startup configuration that exists on the NVRAM.

The ‘copy running-config tftp’ command

Router# copy running-config tftp

This command is used to back up the running configuration on the TFTP server.

The ‘copy tftp running-config’ command

Router# copy tftp running-config

This command is used to restore the router’s configuration from the TFTP server to the router’s RAM.

10.5 Global configuration mode commands

10.5.1 Configuring a host name

We use the following command in order to assign a name to the router,

Router(config)# hostname name

Image2001.JPG Figure 10.12:assigning a hostname to the router.

You can observe that the hostname is changed from ‘Router’ to the new hostname ‘R1’.

10.5.2 Configuring a password

Enable PW

Enable password is the password that the router asks us to enter when we try to enter to the privileged mode from the user exec mode, as seen in figure (10.13).

Image2008.JPG Figure 10.13: asking for the password.

To assign the password, we use the following command,

Router(config)# enable password password

Image2016.JPG Figure 10.14: assigning a password.

Enable secret PW

It is the same as the ‘enable password’, but the difference is that it is stored in the router’s configuration in an encrypted form.

To configure a ‘secret PW’, we use the following command:

Router(config)# enable secret password

Image2023.JPGFigure 10.14: assigning a secret password.

Console PW

The console PW is used to authenticate the user when he tries to connect to the router through its console port.

To assign a console PW to the router, we use the commands seen in figure (10.15).

Image2032.JPG Figure 10.15: assigning a console password.

Auxiliary PW

The auxiliary PW is used to authenticate the user when he tries to connect to the router through its auxiliary port.

To assign an auxiliary PW to the router, we use the commands seen in figure (10.16).

Image2039.JPG Figure 10.16: assigning an auxiliary password.

Telnet PW

The telnet PW is used to authenticate the user when he tries to connect to the router through the telnet.

To assign a telnet PW to the router, we use the commands seen in figure (10.17)

Image2047.JPG Figure 10.17: assigning a telnet password.

10.6 Specific configuration modes

10.6.1 The ‘router configuration mode’

This mode is one of the specific configuration modes. In addition, it is used to configure the routing protocols on the router.

10.6.2 The ‘interface configuration mode’

The interface configuration mode is one of the specific configuration modes. In addition, it is used to assign an IP address to a certain interface, and bringing up or shutting down a certain interface.

To enter to the interface configuration mode from the global configuration mode, we use the following command:

Router(config)# interface type number

Image2055.JPG Figure 10.18:entering to the interface mode.

To assign an IP address and a subnet mask to a certain interface, we use the following command:

Router(config)# ip address ip subnetmask

The ‘no shutdown’ command is used to bring up the interface; this is because its default status is ‘shutdown’.

Image2063.JPG Figure 10.19: assigning an IP address to an interface, and bringing it up.

10.7 CDP (Cisco Discovery Protocol)

The CDP is a Cisco proprietary protocol that allows us to know the neighbors of the device that we are currently connected to.

Suppose that we have the following network,

Image2073.JPGFigure 10.19: CDP protocol is used to know the neighboring devices.

You are connected to R1 and need to know its neighbors. Simply, you can use the following command,

Router# show cdp neigbors

Then, you will be able to show the neighboring devices of R1 as seen in figure (10.21).

5679.jpgFigure 10.10: the CDP neighbors.

The CDP protocol operation depends on the following,

Every Cisco networking device is sending a CDP packet every a specific time period to its neighbor. This CDP packet contains some information about the device.

The ‘CDP timer’ is the periodic duration in which the Cisco networking device is sending a CDP packet.

The ‘CDP hold time’ is the amount of time in which a Cisco networking device will hold the received CDP packet from its neighbor.

To display the CDP timer and the hold time values, we can use the following command,

Router# show cdp