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

  • 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
    GfgSwitch(config-line)#login
    
  • 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
    GfgSwitch(config-line)#exit
    

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

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Recommended Posts:


    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



    Improved By : master_abhig

    Article Tags :
    Practice Tags :


    12


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.