How to Enable SSH on Cisco Switches, Cisco Router and Cisco ASA

When you configure a Cisco Router, Cisco Switch, Cisco ASA device, you have to use the console cable and connect directly to the system to use it.

Please follow the steps mentioned below, which will enable SSH access to your Cisco devices. Once you enable SSH, We can use it remotely using Putty or any other SSH client.

1. Setup Management IP on device.

Firstly, Please make sure you have performed basic network configurations on your switch. For example, We assign default gateway, assign management IP-address, etc. If this is already done.
In the following example, the management IP address is set as in the 100 VLAN. The default gateway points to the firewall, which is

# ip default-gateway             
# interface vlan 100
(config-if)# ip address

2. Set hostname and domain-name on the device

Next, Please make sure the switch has a hostname and domain-name set properly.

# config t
(config)# hostname Sw1
(config)# IP domain-name

3. Generate the RSA Keys on-device.

The switch or router should have proper RSA keys that it will use during the SSH process. So generate these by using the crypto command as shown below.

Sw1(config)# crypto key generate rsa
 The name for the keys will be:
How many bits in the modulus [512]: 1024
Generating 1024 bit RSA keys, keys will be no exportable..[OK]
Also, if you are running on an older Cisco IOS image, it is highly recommended that you for upgrade to the latest IOS.

4. Setup the Line VTY configuration.

Setup line vty configuration parameters, where input transport is set to SSH. Set the login to local, and password to 7 levels.

# line vty 0 4
(config-line)# transport input ssh
(config-line)# login local
(config-line)# password 7
(config-line)# exit

If you have not set the console line yet, Please set it to the following values.

# line console 0
(config-line)# logging synchronous
(config-line)# login local

5. Create the username and password

If you don’t have a username created already, do it as shown below.

Sw1# config t
Enter configuration commands, one per line.  End with CNTL/Z.
Sw1(config)# username Ashish password networkingashish

Note: If you don’t have the enable password set up on the switch, do it now.

Sw1# enable secret Cisco

Please Make sure the password-encryption service is turned on, which will encrypt the password, and when you do “sh run”, you will see only the encrypted password and not clear-text password.
Sw1# service password-encryption

5. Verify SSH access on the device.

In switch, if you do ‘sh ip ssh’, it will confirm that the SSH is enabled on this Cisco device.

Sw1switch# sh ip ssh
SSH Enabled - version 1.100
Authentication timeout: 120 secs; Authentication retries: 3

In the above configurations, login from a remote machine to verify that you can ssh to this Cisco switch. In this example, is the management IP-address of the switch.

remote-machine# ssh
login as: Ashish
Using keyboard-interactive authentication.


No comments