Skip to content
Related Articles

Related Articles

Cisco Switch Configuration basic commands

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 03 Jul, 2020
Improve Article
Save Article

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

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
GfgSwitch(config)#ip default-gateway

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) :

  • Enable password :

    The enable password is used for securing privilege mode.

    GfgSwitch(config)#enable password GFGGFG
  • Enable secret password :

    This is also used for securing privilege mode but the difference is that it will be displayed as ciphertext(***) on the configuration file.

    GfgSwitch(config)#enable secret GFGGFG
  • Line console password :

    When a person will take access through console port then this password will be asked.

    GfgSwitch(config)#line console 0
    GfgSwitch(config-line)#password GFG
  • Line VTY password :

    When a person want to access a router through VTY lines (telnet or ssh) then this password will be asked.

    GfgSwitch(config)#line VTY 0 2
    GfgSwitch(config-line)#password GFGGFG

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
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!