Troubleshooting notes · Security
SSH connection refused on IOS XE: no RSA key
SSH to a Cisco IOS XE router is refused and show ip ssh says SSH Disabled. How to see why, and how to generate the key IOS XE 17.18 asks for. Real output from Cisco IOS XE 17.18.
The symptom
SSH to the router is refused, and show ip ssh says SSH Disabled. The router even tells you what it wants:
MGMT# ssh -l admin 10.0.99.1
% Connection refused by remote host
R1# show ip ssh
SSH Disabled - version 2.0
%Please create an RSA key of atleast 3072 bits or an EC key of atleast 384 bits to enable SSH server functionality
...
IOS Keys in SECSH format(ssh-rsa, base64 encoded): NONE
R1# show crypto key mypubkey rsa
R1#
(no keys)
Why it happens
The SSH server needs a key pair, and this router has none. Without a key, SSH stays disabled however the vty lines are configured. On IOS XE 17.18, the message asks for an RSA key of at least 3072 bits (or an EC key of at least 384 bits). That's the recommended size rather than a hard limit: in the lab, a 2048-bit RSA key also enabled SSH, with a security warning. Keys under 2048 bits can't be generated at all on 17.18, so older guides that use 1024 bits no longer work.
The fix
Generate the key in privileged EXEC mode (the configuration-mode form of this command is deprecated on 17.18), and use SSH version 2:
R1# crypto key generate rsa modulus 3072
R1# configure terminal
R1(config)# ip ssh version 2
The key pair is named after the router's hostname and domain name, so set a hostname (other than the default) and an ip domain name first.
Check it
show ip ssh should no longer say SSH Disabled, and show crypto key mypubkey rsa should list the new key. If SSH still fails, check the vty lines next: transport input ssh and any access-class.
Practise this fault
This fault is in ENCOR Lab 27 of ENCOR Core Labs: a ready-made GNS3 project where you find and fix it yourself, alongside the other faults in the ticket, with the tested solution.
Or start with 15 free labs (5 each from CCNA, ENARSI and ENCOR), by email:
We’ll email you the download links and occasional lab tips. Unsubscribe with one click, any time. Your address is never shared.