2

I'm a total beginner in networking knowledge in general. Tried posting this in the Network Engineering Stack Exchange but they sent me here. My main goal is to be able to simulate a device so I can SSH into it from a Python application and get the output of the commands. But first, I'm trying to manually SSH into the device from the terminal.

I'm using GNS3 to simulate the network and a CISCO C7200 image. I'm using Manjaro Linux. My topology:

enter image description here

Router config:

conf t
hostname R1
ip domain-name local
crypto key generate rsa
ip ssh version 2
line vty 0 4
transport input ssh
login local
exit
username admin password 1234
exit

From a terminal, I can telnet into it just fine running:

telnet 127.0.0.1 5001

But when I run:

ssh admin@127.0.0.1 -p 5001

the terminal hangs and the R1 console outputs this:

enter image description here

What am I doing wrong?

Gabriel
  • 69

1 Answers1

5

You cannot connect to localhost:5001 with SSH because there is no SSH server running on localhost:5001. As GNS3 is telling you, there is a Telnet server running there, not SSH. So, you need to connect using Telnet.

You seem to think that localhost:5001 is some kind of magic port-forwarding and that somehow GNS3 is clever enough to figure out that you configured an SSH server on port 22 on your switch that it would magically NAT that into port 5001 on the host. But consider this: how would GNS3 know that you have an SSH server running on the switch and that you want to connect to it, rather than, say, an HTTP server?

localhost:5001 is GNS3's way to give you access to the terminal of the switch. If you want to run any kind of services on the switch and connect to them over the network, you need to set up the appropriate networking so you can connect to the virtual switch's management IP.