General Switch commands

Switch Commands
Initial configuration of Switch1 with ip 172.16.10.16
>en
#config t
(config)#enable password cisco
(config)#enable secret cisco
(config)#hostname India-switch1
(config)#ip address 172.16.10.16 255.255.255.0
(config)#ip default-gateway 172.16.10.1
(config)#int f0/1
(config-if)#description Finance
(config-if)#int f0/26
(config-if)#description Trunk
(config-if)#exit
(config)#

Initial Configuration of 2950 Switch with ip 172.16.10.17 255.255.255.0
>en
#config t
(config)#hostame India-switch2
(config)#enable password cisco
(config)#enable password cisco(For better security enable and enable secret password should be different)
(config)#line vty 0 15
(config-line)#login
(config-line)#password telnet
(config-line)#line con 0
(config-line)#login
(config-line)#password console
(config-line)#exit
(config)#int vlan 1
(config-if)#ip address 172.16.10.17 255.255.255.0
(config-if)#no shut
(config-if)#int f0/1
(config-if)#description sales_printer
(config-if)#int f0/12
(config-if)description connection to backbone
(config-if)#exit
(config)#ip default-gateway 172.16.10.1
(config)#

Erasing Switching Configuration 1900
#delete nvram
yes
Erasing Switching Configuration 2950
#erase startup-config
HINT:
verify with command “sh run”

Configuring VLAN
>en
#vlan database
(vlan)#vlan 2 name Cisco
(vlan)#vlan 3 name Microsoft
(vlan)#vlan 4 name Comptia
(vlan)#^c

HINT:
verify with command “sh vlan brief”
verify with sh vlan

Assigning Switch Ports to VLAN
(config)#int f0/2
(config-if)#switchport access vlan 2
(config-if)#int f0/3
(config-t)#switchport access vlan 3
(config-if)#int f0/4
(config-if)#switchport access vlan 4
(config-if)#

HINT:
verify with sh vlan brief

Configuring Trunks ports
(config)#int f0/12
(config-if)#switchport mode trunk
(config-if)#^z

HINT:
To disable Trunk use- switchport mode access
To verify Trunking use sh running config

Configuring Inter-vlan Routing for 2950 connecting to 2600
(config)#int f0/0.1
(config-if)#encapsulation dot1q vlan (d number)

Configuring VTP
(config)#vtp mode server

(config)#vtp mode server
(config)#vtp domain routersim
(config)#^z

HINT:
verify with sh vtp status
By default VTP mode is server in all switch

Here is a related post you maybe interested in: General Router Commands

Written by actsupp-r0cks