1. Qué es el CLI de Cisco IOS?

La interfaz de línea de comandos (CLI) de Cisco IOS es la forma principal de interactuar con routers y switches Cisco para configurar, monitorear y gestionar el dispositivo. Permite introducir comandos directamente para ejecutar acciones, ver estados y modificar configuraciones.

Formas de acceso al CLI

Antes de usar el CLI, debes acceder al dispositivo:

  • Consola física: con un rollover cable conectado al puerto RJ45 del dispositivo
  • SSH (remoto seguro)
  • Telnet (remoto no cifrado y menos seguro)

Jerarquía de modos de comando

User EXEC Mode:
  • Modo inicial tras el login.
  • Permite comandos básicos como show, ping, traceroute.
  • Prompt típico: Router>
  • No permite modificar la configuración.
Privileged EXEC Mode:
  • Modo con más privilegios.
  • Accedido desde User EXEC usando:
  • enable
  • Prompt típico: Router#
  • Permite ver configuraciones completas y comandos avanzados (show running-config, reinicios, etc.).
  • Comandos aquí no cambian la configuración por sí solos; solo la muestran o gestionan.

Global Configuration Mode

  • Permite hacer cambios a la configuración del sistema.
  • Se accede desde Privileged EXEC:
  • configure terminal
  • Prompt típico: Router(config)#
  • Aquí se configuran parámetros que afectan al dispositivo en general.

Sub-modos (Interface, Line, Protocols, etc.) Desde el modo de configuración global puedes entrar a modos más específicos como:

  • Interface configuration (para configurar interfaces de red)
  • Line configuration (consola, VTY/SSH/Telnet)
  • Routing protocols
  • Access-list Ejemplo para entrar a modo de interfaz: interface FastEthernet0/1

Prompt típico: Router(config-if)#

Otros modos

  • Setup mode: asistente de configuración inicial.
  • ROM Monitor (ROMMON): modo de recuperación cuando no puede arrancar la IOS.

Ayuda y asistencia en el CLI

  • Usar ? para listar comandos disponibles en el modo actual o ver sintaxis de comandos. Router#? Router#show ? show version show the version info
  • También puedes completar comandos con TAB.

Comandos básicos frecuentes

  • show version — muestra datos del software IOS, versión y hardware.
  • show running-config — muestra la configuración en memoria activa.
  • show startup-config — muestra configuración guardada para arranque.

Configuración y guardado

  • copy running-config startup-config — guarda la configuración actual para futuros reinicios.
  • exit — sale de un modo al anterior.
  • end o Ctrl+Z — vuelve directamente a Privileged EXEC.

Privilegios y seguridad

  • Los comandos disponibles dependen del nivel de privilegio (0-15). Modos superiores requieren autenticación adecuada.

Conceptos importantes adicionales

a. Niveles de privilegio

  • Cada modo y comando tiene un nivel de privilegio asociado que restringe su uso según credenciales.

b. Pipe y filtros de salida

Es posible filtrar la salida de comandos show usando tuberías como: show running-config | include interface Esto ayuda a enfocarse en información relevante.

lab commands:

crtl + shift + 6 = ctrl + c = exit command enable -> enter root mode (privileged) configure terminal -> para entrar al modo de configuracion global hostname R1 -> asigno nombre al dispositivo enable password CCNA -> para proteger el modo privilegiado con password show running-config/sh run -> mostrar configuraciones actuales -> muestra password sin encriptacion service password-encryption -> encriptar password desde el modo de configuracion global enable secret Cisco -> desde modo de configuracion global

si hay configurados secret y password, tendra mas jerarquia secret y solo este sera valido

do sh run -> mostrar running configuration desde el modo de configuracion global

copy running-config startup-config/copy run start -> desde privileged mode

el modo terminal en la tab “desktop” sirve para cuando nos conectamos a un dispotivo a traves del cable de terminal, la opcion “command line” sirve para configurar el dispotivo mismo

comandos utiles

(desde configure terminal) banner motd “este es el dispositivo de luka!!”-> configurar banner al iniciar la terminal show running-config -> ver configuracion completa show ip interface brief -> mostrar todas las interfaces y su estado show running-config interface fastethernet0/1 -> mostrar configuracion por defecto de una interfaz en particular line console 0 -> selecciona el primer puerto de consola fisica para configurar contrasenas, etc.

host

Secure access to the console line.

To secure access to the console line, access config-line mode and set the console password to letmein. S1# configure terminal Enter configuration commands, one per line. End with CNTL/Z. S1(config)# line console 0 S1(config-line)# password letmein S1(config-line)# login S1(config-line)# exit S1(config)# exit %SYS-5-CONFIG_I: Configured from console by console S1#

Secure privileged mode access.

Set the enable password to c1$c0. This password protects access to privileged mode. Note: The 0 in c1$c0 is a zero, not a capital O. This password will not grade as correct until after you encrypt it in Step 8. S1> enable S1# configure terminal S1(config)# enable password c1$c0 S1(config)# exit %SYS-5-CONFIG_I: Configured from console by console

Encrypt the enable and console passwords.

As you noticed in Step 7, the enable secret password was encrypted, but the enable and console passwords were still in plain text. We will now encrypt these plain text passwords using the service password-encryption command. S1# config t S1(config)# service password-encryption S1(config)# exit

Configure an encrypted password to secure access to privileged mode.

The enable password should be replaced with the newer encrypted secret password using the enable secret command. Set the enable secret password to itsasecret. S1# config t S1(config)# enable secret itsasecret S1(config)# exit

Save and Verify Configuration Files to NVRAM

Save the configuration file. You have completed the basic configuration of the switch. Now back up the running configuration file to NVRAM to ensure that the changes made are not lost if the system is rebooted or loses power. S1# copy running-config startup-config Destination filename [startup-config]?[Enter] Building configuration… [OK]

dispositivos intermediareios

Configure switch S1 with an IP address.

Switches can be used as plug-and-play devices. This means that they do not need to be configured for them to work. Switches forward information from one port to another based on MAC addresses.

Use the following commands to configure S1 with an IP address. S1# configure terminal Enter configuration commands, one per line. End with CNTL/Z. S1(config)# interface vlan 1 S1(config-if)# ip address 192.168.1.253 255.255.255.0 S1(config-if)# no shutdown %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up S1(config-if)# S1(config-if)# exit S1#