Open In App

Cisco Switch Configuration basic commands

Prerequisite – Switch Functions

A switch is a layer 2 device used to forward packet from one device to another within the network. It forwards the packet through one of its ports on the basis of destination MAC address and the entry in the MAC table.



Following basic commands are used to configure a new switch :

1. Changing the hostname of a switch to GfgSwitch :



It is used to set the name of the device.

switch(config)#hostname GfgSwitch
GfgSwitch(config)#

2. To add a banner message :

It provides a short message to the user who wants to access the switch.

GfgSwitch(config)#banner motd &
Enter Text message. End with character '&'
$ This is GeeksforGeeks floor Switch &

3. To set IP address in Switch :

IP address is the address of device in network.

GfgSwitch(config)#interface vlan1
GfgSwitch(config-if)#ip address 172.16.10.1 255.255.255.0
GfgSwitch(config-if)#exit
GfgSwitch(config)#ip default-gateway 172.16.10.0

4. To set the current clock time :

This is set the current time stored in the switch.

GfgSwitch#clock set 3:03:14 June 25 2020

5. Apply password protection (enable password, secret password, console password and vty password) :

6. Copy to startup-configuration file from running-configuration file :

GfgSwitch#copy running-config startup-config

7. To watch startup-configuration file and running-configuration file :

GfgSwitch#show startup-config
GfgSwitch#show running-config

8. Clear mac address table :

Switch stores MAC addresses in MAC address table

GfgSwitch#clear mac address-table
Article Tags :