How to Configure SSH on Cisco Router in GNS3

To configure Cisco Routers for the first time, you must use the console connection. After connecting to the device using the console, you can assign an IP address, and then enable Telnet or SSH to manage over LAN/WAN.

How to Configure SSH on Cisco Router in GNS3

How to Configure SSH on Cisco Router

For security reasons, configuring Routers with Telnet over LAN or WAN is not recommended. It is recommended that you configure the SSH connection instead of Telnet.

Because SSH provides a secure connection, it encrypts your data and allows you to securely manage your network.

In our previous article, we reviewed how to make a Telnet connection. In this article, we will also configure SSH on the Router using the network simulator.

How to Enable SSH in Cisco Router

We will use GNS3 and VMware Workstation for configuration. Create a new virtual machine on VMware and install a Windows operating system.

If you haven’t added a Router IOS image before, you can take a look at Adding Routers to GNS3.

After completing the preparations for SSH configuration with GNS3, follow the steps below.

   Step 1

Now open the GNS3 program and type a name for the new project.

Creating a New Project on GNS3

   Step 2

Drag and drop the previously added Router into the workspace.

Add a Router to the Workspace

   Step 3

Add a Switch and Host to the workspace and wire the network devices.

Add Switch and Virtual Computer to Workspace

   Step 4

After creating a small network topology, open the Virtual Network Editor of the VMware virtualization program and configure a VMnet for the virtual machine.

Cabling Network Devices in GNS3

   Step 5

Create a VMnet in the Virtual Network Editor program, and then assign the IP address to it from the network and share center settings on your Host as shown in the image below.

VMnet Setting on Host

   Step 6

Type an IP block for VMnet3 in the virtual editor, select Host-Only and click OK.

Virtual Network Editor

   Step 7

Configure the virtual machine’s network adapter setting to Custom (VMnet3).

Configure a Virtual Machine as Host-Only

   Step 8

Configure the virtual machine’s network adapter setting to Custom (VMnet3). Click Start / Resume all nodes to run the router.

Start/Resume all nodes

   Step 9

To enable SSH after running the router, open the CLI prompt and perform the following commands in order.

R1# conf t
R1(config)# interface fastethernet0/0
R1(config-if)# ip address 192.168.8.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)#ip domain-name sysnettechsolutions.com
R1(config)#crypto key generate rsa general-keys modulus 1024
The name for the keys will be: R1.sysnettechsolutions.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...
R1(config)# ip ssh time-out 15
R1(config)# ip ssh authentication-retries 2
R1(config)# ip ssh version 2
R1(config)# username cisco privilege 15 password cisco123
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# privilege level 15
R1(config-line)# transport input ssh
R1(config-line)# exit
R1(config)# end
R1# wr

 
SSH Activation

   Step 10

Open the Putty program on your virtual computer and enter the IP address of the Router’s FastEthernet0/0 interface in the IP address section, and enter 22 in the Port number section and click the Open button.

PuTTY Configuration

   Step 11

In the Putty security alert window, click Yes.

PuTTY Security Alert

   Step 12

The SSH connection to the Router will be successfully established as in the following image.

Type the username you created in Login as and press Enter.

SSH / Login As

   Step 13

Enter the user password (cisco123) you created in the Password section and press Enter.

Password Entry

   Step 14

Once connected to the Router with SSH, you can now easily manage your device over LAN or WAN.

SSH Connection

   Step 15

To view SSH sessions on the router, type the show line command in Privileged Mode and press Enter.

You can check the Telnet or SSH connections from the image below.

show line command

   Step 16

To check the SSH version, execute the show ssh command in privileged configuration mode.

You can check that the SSH version is 2.0 in the show command output.

show ssh command

   Step 17

You can use at the command prompt to initiate an SSH session on a PC or other router on the network.

ssh -l (User Name) (Router IP Address)

   Step 18

To connect from Router to Router, execute the ssh -l cisco 192.168.8.1 command, and then type your password and press Enter.

ssh -l cisco 192.168.8.1

   Step 19

You can see SSH sessions again when you use the show ssh command.

Viewing SSH Sessions on a Router

   Step 20

Use the show line command to display the current session.

Show line command

   Step 21

You can use the exit command to terminate the SSH connection.

Exit Secure Shell Connection

How to Connect from Router to Router with SSH Protocol ⇒ Video

You can watch the video below to make an SSH connection from the virtual machine to the Router using the simulator program and also subscribe to our YouTube channel to support us!

   Final Word


In this article, we have examined how to use SSH on Router with a network simulator program. Thanks for following us!

   Related Articles


♦ Cisco Router Interface
How to Connect GNS3 to VMware
♦ GNS3 DHCP
♦ GNS3 Static NAT
♦ GNS3 Dynamic NAT

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *