Are you just starting to study for the CCNA ICND1 certification? One of the objectives of the certification is to configure the hostname of a switch.
During the setup of a Cisco switch there is one configuration command that sets the hostname. The following commands were performed on a Cisco Catalyst 2960 switch.
Configure a Switch Hostname
From User EXEC mode, the device name will be part of the prompt which right now is just Router. To change the hostname of the router we need to enter User EXEC mode and then into Privileged EXEC mode.
Switch>enable Switch# Switch#configure terminal Switch(config)#
Now that we are in Global Configuration Mode, we issue the hostname command followed by the name we want to give this router and hit Enter.
Switch(config)#hostname Core-Switch-A Core-Switch-A(config)#
Notice after you hit Enter, the prompt changes to the hostname you just configured. The change gets put into the running-config. To save the changes you make the running-config must be saved to the startup-config.
The syntax is as follows
hostname command starts the whole command which then needs to be followed by your input.
device-name can be anything from your input to name this device.
To save the running-config we must leave Global Configuration Mode and go back to the User EXEC Mode.
Now to save your changes to the startup-config we tell the router to save what changes are in the running-config to the startup-config.
Core-Switch-A#copy running-config startup-config
Verify Hostname Configuration
You can verify if the hostname configuration stuck by checking the user prompt. It should display the switch hostname. You will also verify the configuration in the running configuration on the hostname line.
Core-Switch-A#show running-config Building configuration... Current configuration : 1050 bytes ! version 12.2 ! hostname Core-Switch-A Full Hostname Configuration Switch#configure terminal Switch(config)#hostname Core-Switch-A Core-Switch-A(config)#end Core-Switch-A#copy running-config startup-config
Putting it all together in one single configuration.
Switch>enable Switch# Switch#configure terminal Switch(config)#hostname Core-Switch-A Core-Switch-A(config)#