How to Configure SSH on Cisco Switch?
To configure SSH on a Cisco switch, you need to perform the following steps:
Enable IP connectivity:
Before configuring SSH, make sure that the switch has IP connectivity. You can verify this by using the ping command to test connectivity to a known IP address.
Configure a hostname:
It is recommended to configure a hostname on the switch before enabling SSH. The hostname is used to identify the switch on the network and is part of the SSH security certificate. Use the following command to set the hostname:
Replace with the desired hostname.
Enable the SSH server:
The SSH server must be enabled on the switch before you can use SSH to connect to it. Use the following command to enable the SSH server:
switch(config)# ip ssh version 2
switch(config)# crypto key generate rsa
switch(config)# ip ssh time-out 60
switch(config)# ip ssh authentication-retries 2
Create a user account:
In order to log in to the switch via SSH, you need to create a user account. You can use the following command to create a local user account:
switch(config)# username password
Replace with the desired username and with the desired password.
Configure a VTY line:
The VTY lines are used to allow remote access to the switch. Use the following command to configure a VTY line for SSH:
switch(config)# line vty 0 15
switch(config-line)# transport input ssh
switch(config-line)# login local
Save the configuration:
To make the changes persist across reboots, use the following command to save the configuration:
switch# copy running-config startup-config
Verify the SSH configuration:
You can verify the SSH configuration by using the following command:
switch# show ip ssh
Note: After configuring SSH, you can use a SSH client such as PuTTY to connect to the switch using the IP address, username, and password.