Tuesday 27 September 2016

How to Enable SSH on Cisco Switch, Router and ASA

How to Enable SSH on Cisco Switch, Router and AS

 I have a Cisco switch and Router  in my network, which I can access by hooking up a console cable directly to the device. I like to access the switch remotely using SSH. How can I enable SSH 


By default, when you configure a Cisco device, you have to use the console cable and connect directly to the system to access it. Follow the steps mentioned below, which will enable SSH access to your Cisco devices. Once you enable SSH, you can access it remotely using PuTTY or any other SSH client.

1. Setup Management IP

First, make sure you have performed basic network configurations on your switch. For example, assign default gateway, assign management ip-address, etc. If this is already done, skip to the next step.
In the following example, the management ip address is set as 192.168.101.2 in the 101 VLAN. The default gateway points to the firewall, which is 192.168.101.1
# ip default-gateway 192.168.101.1

# interface vlan 101
(config-if)# ip address 192.168.101.2 255.255.255.0

2. Set hostname and domain-name

# config t
(config)# hostname myswitch
(config)# ip domain-name thegeekstuff.com

3. Generate the RSA Keys

The switch or router should have RSA keys that it will use during the SSH process. So, generate these using crypto command as shown below.
myswitch(config)# crypto key generate rsa
 The name for the keys will be: myswitch.thegeekstuff.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]: 1024
 % Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

4. Setup the Line VTY configurations

Setup the following line vty configuration parameters, where input transport is set to SSH. Set the login to local, and password to 7.
# 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, set it to the following values.
# line console 0
(config-line)# logging synchronous
(config-line)# login local

5. Create the username password

If you don’t have an username created already, do it as shown below.
myswitch# config t
Enter configuration commands, one per line.  End with CNTL/Z.
myswitch(config)# username ramesh password mypassword
Note: If you don’t have the enable password setup properly, do it now.
myswitch# enable secret myenablepassword
Make sure the password-encryption service is turned-on, which will encrypt the password, and when you do “sh run”, you’ll seee only the encrypted password and not clear-text password.
myswitch# service password-encryption

No comments:

Post a Comment

BE AWARE OF FaKe Call

Phishing is defined as any attempt to obtain your personal and financial information. Mostly, phishing is carried out via emails. These ...