How to Enable SSH on Cisco Switches, Router and ASA


When you configure a Cisco 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 192.168.1.2 in the 100 VLAN. The default gateway points to the firewall, which is 192.168.1.1.




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

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 Networkinghub.com

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: networkinghub.com
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, 192.168.1.2 is the management IP-address of the switch.

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

Sw1>en
Password:
Sw1#



No comments