Sei sulla pagina 1di 5

CONFIGURAR SSH EN UN ROUTER CISCO Usar Telnet para gestionar un router, un switch o un firewall no es seguro, ya que transmite en texto

claro a travs de la red, lo cual es un problema cuando se transmite el nombre de usuario o password. Una alternativa a usar Telnet y que es capaz de remediar esta laguna es el uso de SSH. Al igual que con Telnet, tu puedes usar SSH para entrar comandos IOS a travs de la red o copiar ficheros sobre la red a un dispositivo. Pero con SSH, el cual usa certificados digitales encriptadas, apenas tienes que preocuparte por la seguridad. Hay dos versiones de Secure Shell : SSH1 y SSH2. Cisco IOS 12.1(3)T fue la primera versin en soportar SSH1, no requiere encriptacin de datos standard ( DES ) o 3DES. Con la versin SSH2 soportar 3DES. SSH1 y SSH2 son dos protocolos diferentes. SSH2 ofrece mucha ms seguridad y es recomendable usarlo siempre que sea posible. Cisco IOS ofrece la posibilidad de actuar como servidor SSH o cliente SSH. As tu puedes conectarte al servidor SSH en el router desde un cliente SSH o desde el cliente SSH en el router a un servidor SSH. Para configurar SSH en el router, debemos asegurarnos de tener la imagen IOS apropiada: c2600-ik9o3s3-mz.122-15.T9.bin.

Los siguientes pasos habilitarn SSH en un router Cisco, tambin deshabilitar Telnet:
1. 2. 3. 4. 5. 6. 7. Enter configuration mode. Assign a host name for the router. Create at least one local user account. Assign a DNS domain name for the router. Generate an RSA key. Configure SSH timeout and retries settings. Enable SSH on virtual type terminals (VTYs).

! Assign a host name for the router hostname myrouter ! Create at least one local user account aaa new-model username cisco password cisco ! Assign a DNS domain name for the router ip domain-name yourdomain.com ! Generate an RSA key crypto key generate rsa ! Configure SSH timeout and retries settings ip ssh time-out 60 ip ssh authentication-retries 3 ! Enable SSH on VTYs line vty 0 4 transport input ssh

Testear la Autenticacin sin SSH. Primero testee la autenticacin sin SSH para comprobar que la autenticacin trabaja con el router correctamente. La autenteicacin puede ser con un username y password local o con un servidor AAA que corre TACAC+ o RADIUS.
!--- The aaa new-model command causes the local username and password on the router !--- to be used in the absence of other AAA statements. aaa new-model username cisco password 0 cisco line vty 0 4 transport input telnet !--- Instead of aaa new-model, you can use the login local command.

Testear la Autenticacin sin SSH. Con el fin de testear la autenticacin con SSH tu debes aadir al router las siguientes lineas y probar la conexin desde un PC Cliente.

ip domain-name rtp.cisco.com !--- Generate an SSH key to be used with SSH. crypto key generate rsa ip ssh time-out 60 ip ssh authentication-retries 2

Prevenir conexiones non-SSH.


line vty 0 4 !--- Prevent non-SSH Telnets. transport input ssh

Testear desde un ordenador cliente para ver que no se pueden establecer conexiones Telnet Configurar un Router o Switch como Cliente SSH.
Hay que realizar los siguientes 4 pasos para habilitar SSH en un router Cisco:

1.
2. 3. 4.

Configure the hostname command. Configure the DNS domain. Generate the SSH key to be used. Enable SSH transport support for the virtual type terminal (vtys).

!--- Step 1: Configure the hostname if you have not previously done so.

switch/router(config)# hostname carter


!--- The aaa new-model command causes the local username and password on the router !--- to be used in the absence of other AAA statements.

switch/router(config)# aaa new-model switch/router(config)# username (user ) password 0 (password)


!--- Step 2: Configure the DNS domain of the router.

switch/router(config)# ip domain-name rtp.cisco.com


!--- Step 3: Generate an SSH key to be used with SSH. crypto key generate rsa ip ssh time-out 60 ip ssh authentication-retries 2

!--- Step 4: By default the vtys' transport is Telnet. In this case, !--- Telnet is disabled and only SSH is supported. line vty 0 4 transport input SSH !--- Instead of aaa new-model, you can use the login local command.
Corra estos commandos desde el Cliente Cisco IOS SSH (Reed) al Servidor Cisco IOS SSH (Carter) in con el fin de testear esto:

SSH v1:

ssh -l cisco -c 3des 10.13.1.99


SSH v2:

ssh -v 2 -c aes256-cbc -m hmac-sha1-160 -l cisco

10.31.1.99

Configurar un hostname al router: Router(config)# hostname TR-Router. Configurar un domain name en el router: TR-Router(config)# ip domain-name TechRepublic.com Crear un par de claves de encriptacin RSA para que el router use autenticacin y encriptacin de los datos SSH. Una de las cosas que tenemos que responder durante el proceso es el modelo del tamao de clave. Asegurese de que al menos es de 768-bits: TR-Router(config)# crypto key generate rsa

The name for the keys will be: TR-Router.TechRepublic.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: 768% Generating 768 bit RSA keys ...[OK] TR-Router(config)#*Mar 1 00:17:13.337: %SSH-5-ENABLED: SSH 1.5 has been enabled Como podemos despus de que el sistema genera la clave, se recibir un mensaje de que: - SSH 1.5 se ha habilitado automticamente en el router. Esto es la forma que tiene cisco de decirle al router que est corriendo SSH1. - SSH 1.99 indicaria que ambos SSH1 y SSH2 estaran habilitados. - SSH 2.0 indicara que solo SSH2 estara habilitado.

Configurando los parametros opcionales completara el proceso de configuracin de SSH en el router. switch/router(config)# ip ssh authentication-retries switch/router(config)# ip ssh time-out switch/router(config)# ip ssh version 2

Para ver el estatus de SSH, se pueden usar los siguientes comandos: Show ip ssh : para ver los parmetros de SSH. Show ssh : para ver las conexiones de SSH.

TR-Router# show ip ssh SSH Enabled - version 1.5Authentication timeout: 120 secs; Authentication retries: 3 3TR-Router# show ssh No SSH server connections running.TR-Router# Tambin podemos usar el cliente construido en el dispositivo para conectarnos a otros servidores SSH. Desde el Privilege Mode entraremos el comando ssh.
TR-Router# ssh ? -c Select encryption algorithm -l Log in using this username -o Specify options -p Connect to this port WORD IP address or hostname of a remote system.

Potrebbero piacerti anche