SSH - domain-name prerequisite

SSH relies on public-key cryptography for secure communication. To enable SSH on a Cisco IOS device, you must generate an RSA key pair. In the process of this RSA key pair generation, the device’s hostname and domain name are used to form the label for the key pair. A Cisco device always has a default hostname, however, there is no domain name configured by default. For this reason, the domain name must be defined before RSA key pair generation takes place. Thus it is a prerequisite to configuring SSH.

Now it is important to note here that the domain name and hostname do not directly influence the mathematical generation of the RSA key pair. Instead, they are used to uniquely identify the generated key pair on the device. The combination of the hostname and domain name creates that label, which is associated with the key pair for identification purposes within the device’s configuration.

https://networklessons.com/cisco/ccna-200-301//configure-ssh-cisco-ios