Enable Communication Between GNS3 Appliances & The Host Machine (Ubuntu 24.04)
Recently, I set up a GNS3 server using an Ubuntu 24.04 VM to run and test my network emulations. While working on a project, I needed to establish an SSH connection between the host (the Ubuntu 24.04 server) and the virtual GNS3 appliances running inside it.
The basic network configuration was straightforward, and I could ping the devices just fine. However, I quickly hit a wall when trying to SSH into legacy appliances (like the Cisco C7200). Because modern Ubuntu 24.04 uses updated OpenSSH protocols, it actively rejects the older cryptographic algorithms offered by these legacy devices.
Getting this working required some specific SSH workarounds, so I decided to turn this into a runbook documentation for my future self—and for anyone else dealing with connection refused errors in their GNS3 labs.
Prerequisites
Before we jump into the SSH workarounds, make sure you have the base lab environment up and running:
A Working GNS3 Server: For this guide, we are using an Ubuntu 24.04 host.
A Connected GNS3 Client: Ensure your local client is successfully communicating with your GNS3 server.
Working GNS3 Appliances: You will need at least one running legacy node to test the connection (e.g., a Cisco c7200 router).
Setting up The Topology
If you expect to connect more than one router to the host, grab an Ethernet switch from the Switches section and connect your routers to it.
Lastly, add a NAT node from the End Devices section. Connect this NAT node to your switch—or directly to your router if you are only testing a single device. This NAT node is crucial, as it acts as the bridge connecting your GNS3 lab to your Ubuntu host machine.
When you're done, you should have a topology that looks similar to mine, even if the exact layout isn't identical.
Now it's time to configure the routers in our topology. To successfully connect to these devices from the Ubuntu host via SSH, we need to handle two main tasks on each router:
Configure an Interface with an IP: We need to assign an IP address to the interface connected to our NAT node/switch so it has a valid route to the host.
Configure SSH: We need to set up a local user, set a domain name, and generate the crypto keys required for the router's SSH service to start.
1. Configure an Interface with an IP
The NAT node we added earlier automatically acts as a DHCP server (managed by the Ubuntu host) for the devices connected to it. Because of this, we can simply configure the router's connected interface as a DHCP client.
Use the following commands in your router's console. Don't forget to replace the placeholder interface (<interface-id>) with the actual interface name used in your topology:
Router> enableRouter# configure terminalRouter(config)# interface <interface-id>Router(config-if)# ip address dhcpRouter(config-if)# no shutdownRouter(config-if)# exit
Router# show ip interface brief
Router(config)# do show ip interface brief
$ ping <interface-ip>
If you receive successful replies, your base networking is completely functional. Now that we know the host can speak to the device, it is time for us to configure SSH on the router.
2. SSH Configuration
Router(config)# hostname R1
R1(config)# ip domain-name mylab.local
R1(config)# crypto key generate rsa
Then change the default SSH version from 1.99 to 2 using the following command.
R1(config)# ip ssh version 2Once the keys are generated and the SSH version is changed, we need to create a local user account and configure the VTY (Virtual Teletype) lines to accept SSH connections instead of Telnet.
R1(config)# username admin privilege 15 secret mypassword
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)# exit
R1(config)# do writeIssue: Legacy Cryptography vs. Modern OpenSSH
$ ssh <username>@<router-interface-ip>
Solution: A Dedicated SSH Config File
$ nano ~/.ssh/configHost 192.168.122.*# Re-enable legacy Key Exchange algorithmsKexAlgorithms +diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1# Re-enable legacy RSA signaturesHostKeyAlgorithms +ssh-rsaPubkeyAcceptedKeyTypes +ssh-rsa# Re-enable legacy ciphers just in case the router demands themCiphers +aes256-cbc,aes128-cbc,3des-cbc
$ chmod 600 ~/.ssh/config $ ssh <username>@<router-interface-ip>
.jpg)
Comments
Post a Comment