Learn ssh configuration on cisco switches

This article is all about how to configure ssh on a cisco switch. In the previous article, we learn basic cisco switch configuration. Now in this tutorial, we learn about how to configure ssh on a cisco switch. ssh is generally used for remote login to a device such as PC, server, switch and routers also. ssh configuration is same as telnet but ssh is more secure than telnet because ssh sends all the data in encrypted form.

The main difference between ssh and telnet is that in telnet username and password is sent online in simple text format but in ssh, it sent all the data in the encrypted form. So let’s start here how we configure ssh on a cisco switch.

To understand this configuration we take a lab in cisco packet tracer. In this lab, we take two PCs and one switch as the figure is shown below.

ssh configuration on switch

Now we configure ssh on cisco switch and also check the configuration by using one of the PC. So follow given below commands to configure ssh on a switch

Now to create vlan on switch and to configure a switch use given below command

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname rahul

rahul(config)#interface vlan 1

rahul(config-if)#ip address 1.0.0.1 255.0.0.0

rahul(config-if)#no shut

rahul(config-if)#

%LINK-5-CHANGED: Interface Vlan1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

rahul(config-if)#exit

rahul(config)#line vty 0 5

rahul(config-line)#password 3usageeks

rahul(config-line)#login

rahul(config-line)#exit

Now your switch is configured and vlan is created on your switch now we configure ssh on that switch.

 

Now to configure ssh on a switch use given below commands.

rahul>enable

rahul#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

rahul(config)#ip domain name deepika

rahul(config)#crypto key generate rsa

The name for the keys will be: rahul.deepika

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]

rahul(config)#ip ssh version 2

*Mar 1 0:14:26.847: %SSH-5-ENABLED: SSH 1.99 has been enabled

rahul(config)#line vty 0 5

rahul(config-line)#transport input ssh

rahul(config-line)#exit

Now your switch will be configured by ssh service. Now you can easily configure your switch from anywhere and configure your switch easily. To check this configuration is successfully completed or not, first of all, give IP address to all the PCs and then follow given below steps.

 

To check your ssh configuration use given below commands on one of your PC and check as the given below

Packet Tracer PC Command Line 1.0

 

PC>ssh -l admin 1.0.0.1

Open

Password:

rahul>

If your switch is accessed by the PC that means your ssh configuration takes place correctly.

 

Now if you want to change your username from admin to something else then use given below command.

rahul>enable

rahul#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

rahul(config)#username rahul secret 3usageeks

rahul(config)#line vty 0 5

rahul(config-line)#login local

rahul(config-line)#exit

 

Now to check use given below command on a PC

Packet Tracer PC Command Line 1.0

PC>ssh -l rahul 1.0.0.1

Open

Password:

rahul>

 

Now to troubleshoot your configuration go to switch and use given below command and verify your configuration

rahul>enable

rahul#show arp

Protocol Address Age (min) Hardware Addr Type Interface

Internet 1.0.0.1 – 0004.9A82.669B ARPA Vlan1

Internet 1.0.0.2 18 0002.1732.7AA1 ARPA Vlan1

If you have any problem regarding this feel free to ask and also give feedbak to us because your feedback is valuable to us.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s