How to configure ssh on a switch?


This tutorial is all about ssh configuration on switches. In this tutorial, we all learn about how to configure ssh on a switch. First of all, we will learn about ssh. ssh is used to remote login to a device PC server switch or router securely. Basically, in other words, we can say that ssh is a remote login program as well as telnet which provides you a remote access to a switch, PC, router and a server by which we can manage any device remotely. But ssh configuration is more secure than telnet configuration because telnet username and password are sent online in simple text form but in ssh configuration, it is encrypted and hence make ssh more secure than telnet. So let’s start here how to configure ssh on a Cisco switch.

Now we will take a lab in Cisco packet tracer to learn ssh configuration on a switch. follow these given below steps and codes to configure ssh on a switch.

ssh configuration on switch

learn how to configure ssh on a switch in few simple steps

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 192.168.1.1 255.255.255.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 technohelper24

rahul(config-line)#login

rahul(config-line)#exit

Now follow these steps to configure ssh on a switch

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 gene 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:17:2.27: %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

rahul(config)#

Now your switch will be configured with ssh configuration. Now we assign IP addresses to both the PCs statically because a DHCP server is not taken in this lab. So we provide IP address manually to both the PCs after that we check that ssh is configured successfully on your switch or not by access your switch remotely from a PC which is taken in this lab by us.

Now we check ssh connection from any of your PC

Packet Tracer PC Command Line 1.0

PC>ssh -l admin 192.168.1.1

Open

Password:

rahul>

It means our ssh will be successfully configured on the switch.

Now if you want to change your ssh username from admin to something else then you can do it from entering in switch global configuration mode. Follow these given below change your username

rahul>enable

rahul#configure terminal

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

rahul(config)#username omprakash secret himanshu

rahul(config)#line vty 0 5

rahul(config-line)#login local

rahul(config-line)#exit

Now by these codes your new user will be created, Now you will be logged into your switch from anywhere by entering this username and password on the PC.

Now once again test it from any of your PC by logging through your newly created user 

PC>ssh -l omprakash 192.168.1.1

Open

Password:

rahul>show arp

Protocol Address Age (min) Hardware Addr Type Interface

Internet 192.168.1.1 – 000A.F3E3.D229 ARPA Vlan1

Internet 192.168.1.2 13 000D.BD36.C5B6 ARPA Vlan1

THAT’S IT

If you have any queries regarding this simply comment below and keep attach for further updates from this blog.

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