10.3 Configure a hostname
You will now have an opportunity to configure a hostname on the router. The main reason for configuring a hostname on a device is to easily identify the device when accessing it remotely. For example, if you are working from an office in Milton Keynes but you are configuring a router physically located in London, the only reference you have via the command line is the hostname. It is possible that you could be connected to multiple routers at the same time, so it is important to establish the correct and identifiable hostname before you change the configuration of the device.
Watch the video below (which is about 2 minutes long) to see how to configure a hostname on a router.
It is highly recommended to set a hostname on every router or switch. You need to be aware that there are rules for hostnames. For example, a hostname must not exceed 63 characters. It must start and end with a letter or digit, and contain only letters, digits, or hyphens.
Activity 3 Try it out
Openin a new tab or window so you can read these instructions.
- Select the router, open the CLI tab, then go to the appropriate configuration mode to configure a hostname.
- Configure the hostname ‘Coventry’ on the device and save the configuration.
You should have used the command enable to enter the privileged exec mode, and then the command configure terminal to enter global configuration mode. The next step was to enter the command hostname Coventry. Following this you should have noticed the prompt change from Router (config)# to Coventry (config)#. To save the change you should have entered the command exit to return to privileged exec mode and then used the command copy running-config startup-config.
You’ve now used the commands in the CLI to configure a hostname on a router. Now you know which router you are connected to, you can start making configuration changes. The next section will explain how to set an IP address on a router.