Cisco Switch Configuration basic commands - GeeksforGeeks

03 Jul, 2020
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

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

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

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

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

master_abhig
Computer Networks
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Advanced Encryption Standard (AES)
Multiple Access Protocols in Computer Network
Intrusion Detection System (IDS)
GSM in Wireless Communication
Cryptography and its Types
Introduction and IPv4 Datagram Header
Routing Information Protocol (RIP)
Secure Socket Layer (SSL)
Stop and Wait ARQ
TCP Congestion Control