Follow these directions to assign a hostname to a Cisco router or switch in IOS.
- In IOS, type enable and press enter
- Type configure terminal and press enter
- Type crypto key generate rsa and press enter
- When prompted for the size of the key, type the size and press enter (example: 512 or 1024 or 2048)
- Type exit and press enter
The reload command can be used to return the router or switch to the configuration it had before any changes were made.
To ensure these changes remain saved if the router or switch is restarted, save the changes to the startup-config. Type copy running-config startup-config and press enter. This saves to NVRAM. It is also possible to save the changes to flash using the copy startup-config flash command. Then use the show flash command, and the startup-config file should be listed.