Skip to main content

How to enable SSH login access to a Cisco router



This guide walks you through how to setup SSH on a Cisco Router.
SSH is by far more secure then telnet. Telnet allows your passwords
to be sent in plain text that anyone can see and gain access to your
network. SSH is all encrypted traffic.

NOTE: This should work with any Cisco router provided the Cisco IOS
on the router supports ssh.

Firstly is ssh enabled?

router#sh ip ssh
SSH Disabled - version 2.0
%Please create RSA keys to enable SSH.
Authentication timeout: 60 secs; Authentication retries: 5
In this case its not, if you got a error saying that sh ip ssh is not
recognized then you would know that ssh is not supported or possibly
that the command is different for your platform.
How to enable SSH on a Cisco 800 series

router# config term
router(config)#crypto key generate rsa usage-keys label router-key
The name for the keys will be: router-key
Choose the size of the key modulus in the range of 360 to 2048 for your
Signature Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 1024
Choose the size of the key modulus in the range of 360 to 2048 for your
Encryption Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
router (config)#
000047: *Mar 1 20:40:50.843 UTC: %SSH-5-ENABLED: SSH 1.99 has been enabled
router (config)#exit
According to the line above SSH has been enabled, we can confirm this
by running the sh ip ssh command again.



router#sh ip ssh
SSH Enabled - version 1.99
Authentication timeout: 120 secs; Authentication retries: 3
router#
Now setting the router up to accept ssh logins
Usually it will anyway because by default the transport is set to all
transport preferred all
transport input all
But we want to change that
Router#conf t
!
line vty 0 4
access-class 1 in
exec-timeout 30 0
privilege level 15
login local
transport preferred ssh
transport input ssh
!
Write your config and test it.
_______________________________________________________________________________

Introduction

Secure Shell (SSH) is a protocol which provides a secure remote access connection to network devices. Communication between the client and server is encrypted in both SSH version 1 and SSH version 2. Implement SSH version 2 when possible because it uses a more enhanced security encryption algorithm.
This document discusses how to configure and debug SSH on Cisco routers or switches that run a version of Cisco IOS® Software that supports SSH. This document contains more information on specific versions and software images.

Prerequisites

Requirements

The Cisco IOS image used must be a k9(crypto) image in order to support SSH. For example c3750e-universalk9-tar.122-35.SE5.tar is a k9 (crypto) image.

Components Used

The information in this document is based on Cisco IOS 3600 Software (C3640-IK9S-M), Release 12.2(2)T1.
SSH was introduced into these Cisco IOS platforms and images:
  • SSH Version 1.0 (SSH v1) server was introduced in some Cisco IOS platforms and images that start in Cisco IOS Software Release 12.0.5.S.
  • SSH client was introduced in some Cisco IOS platforms and images starting in Cisco IOS Software Release 12.1.3.T.
  • SSH terminal-line access (also known as reverse-Telnet) was introduced in some Cisco IOS platforms and images starting in Cisco IOS Software Release 12.2.2.T.
  • SSH Version 2.0 (SSH v2) support was introduced in some Cisco IOS platforms and images starting in Cisco IOS Software Release 12.1(19)E.
  • Refer to How to Configure SSH on Catalyst Switches Running CatOS for more information on SSH support in the switches.
Refer to the Software Advisor (registered customers only) for a complete list of feature sets supported in different Cisco IOS Software releases and on different platforms.
The information presented in this document was created from devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If you are in a live network, make sure that you understand the potential impact of any command before you use it.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

SSH v1 vs. SSH v2

Use the Cisco Software Advisor (registered customers only) in order to help you find the version of code with appropriate support for either SSH v1 or SSH v2.

Network Diagram

ssh-1.gif

Test Authentication

Authentication Test without SSH

First test the authentication without SSH to make sure that authentication works with the router Carter before you add SSH. Authentication can be with a local username and password or with an authentication, authorization, and accounting (AAA) server that runs TACACS+ or RADIUS. (Authentication through the line password is not possible with SSH.) This example shows local authentication, which lets you Telnet into the router with username "cisco" and password "cisco."

!--- 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.

Authentication Test with SSH

In order to test authentication with SSH, you have to add to the previous statements in order to enable SSH on Carter and test SSH from the PC and UNIX stations.
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
At this point, the show crypto key mypubkey rsa command must show the generated key. After you add the SSH configuration, test your ability to access the router from the PC and UNIX station. If this does not work, see the debug section of this document.

Optional Configuration Settings

Prevent Non-SSH Connections

If you want to prevent non-SSH connections, add the transport input ssh command under the lines to limit the router to SSH connections only. Straight (non-SSH) Telnets are refused.
line vty 0 4

!--- Prevent non-SSH Telnets.

transport input ssh
Test to make sure that non-SSH users cannot Telnet to the router Carter.

Set Up an IOS Router or Switch as SSH Client

There are four steps required to enable SSH support on a Cisco IOS router:
  1. Configure the hostname command.
  2. Configure the DNS domain.
  3. Generate the SSH key to be used.
  4. Enable SSH transport support for the virtual type terminal (vtys).
If you want to have one device act as an SSH client to the other, you can add SSH to a second device called Reed. These devices are then in a client-server arrangement, where Carter acts as the server, and Reed acts as the client. The Cisco IOS SSH client configuration on Reed is the same as required for the SSH server configuration on Carter.

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

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.

aaa new-model
username cisco password 0 cisco

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

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.

Issue this command to SSH from the Cisco IOS SSH client (Reed) to the Cisco IOS SSH server (Carter) in order to test this:
  • 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
    

Setup an IOS Router as an SSH server that performs RSA based User Authentication

Complete these steps in order to configure the SSH server to perform RSA based authentication.
  1. Specify the Host name.
    Router(config)#hostname <host name>
    
  2. Define a default domain name.
    Router(config)#ip domain-name <Domain Name>
    
  3. Generate RSA key pairs.
    Router(config)#crypto key generate rsa
    
  4. Configure SSH-RSA keys for user and server authentication.
    Router(config)#ip ssh pubkey-chain
    
  5. Configure the SSH username.
    Router(conf-ssh-pubkey)#username <user name>
    
  6. Specify the RSA public key of the remote peer.
    Router(conf-ssh-pubkey-user)#key-string
    
  7. Specify the SSH key type and version. (optional)
    Router(conf-ssh-pubkey-data)#key-hash ssh-rsa <key ID>
    
  8. Exit the current mode and return to privileged EXEC mode.
    Router(conf-ssh-pubkey-data)#end
    
    Note: Refer to Secure Shell Version 2 Support for more information.

Add SSH Terminal-Line Access

If you need outbound SSH terminal-line authentication, you can configure and test SSH for outbound reverse Telnets through Carter, which acts as a comm server to Philly.
ip ssh port 2001 rotary 1
line 1 16
   no exec
   rotary 1
   transport input ssh
   exec-timeout 0 0
   modem In Out
   Stopbits 1
If Philly is attached to Carter's port 2, then you can configure SSH to Philly through Carter from Reed with the help of this command:
  • SSH v1:
    ssh -c 3des -p 2002 10.13.1.99
    
  • SSH v2:
    ssh -v 2 -c aes256-cbc -m hmac-sha1-160 -p 2002 10.31.1.99
    
You can use this command from Solaris:
ssh -c 3des -p 2002 -x -v 10.13.1.99

Restrict SSH access to a subnet

You need to limit SSH connectivity to a specific subnetwork where all other SSH attempts from IP

Comments

  1. How To Enable Ssh Login Access To A Cisco Router >>>>> Download Now

    >>>>> Download Full

    How To Enable Ssh Login Access To A Cisco Router >>>>> Download LINK

    >>>>> Download Now

    How To Enable Ssh Login Access To A Cisco Router >>>>> Download Full

    >>>>> Download LINK 4x

    ReplyDelete

Post a Comment

Popular posts from this blog

INSTALL DOT NET FRAMEWORK ON MULTIPLE SERVERS USING POWERSHELL SCRIPT

Installing .Net 4.5.2 $servers = Array of Servers foreach($server in $servers) { Write-Host “Copying the installation file” copy-item  –path “-SOURCE” –destination “ destination ” Write-Host “Installing .NET 4.5.2” Invoke-Command –Computername $server –Credentials xxxx { C:\Temp\ NET 4.5.2  /passive /norestart }

Connection failed: enforce firewall policy failed (on win 7 / 64bit)

Connection failed: enforce firewall policy failed (on win 7 / 64bit)  error: connection failed: enforce firewall policy failed client: Check point endpoint security r75 build 835002205 on win 7 / 64 bit The solution is to find driver file vsdatant.sys and copy it to system32/drivers Ref :- https://forums.checkpoint.com/forums/thread.jspa?messageID=46927