Cisco Switch Basic Configuration Commands

Cisco Switch Configurations CCNA Level Commands Cheat Sheet

How to Create VLAN


! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#vlan 10
!create vlan 10
Switch(config-vlan)#name ACCOUNTING
!give name for vlan 10
Switch(config)#interface fa0/1
!go to interface we want to assign vlan
Switch(config-if)#switchport access vlan 10
!assign port to vlan 10


How to Create Trunk interface

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface fa0/24
!go to interface we want to assign as trunk
Switch(config-if)#switchport trunk encapsulation dot1q
!use dot1q as encapsulation method
Switch(config-if)#switchport mode trunk
!set up as trunk


How to configure ip address on vlan interface

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface vlan 10
!create interface vlan 10
Switch(config-if)#ip address 10.10.10.1 255.255.255.0
!give ip address for interface vlan 10


How to configure sub interface for router on stick

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface fa0/0
Switch(config-if)#no shut
!go to the interface we want to create sub interface and no shut
Switch(config)#interface fa0/0.10
!create sub interface 10 in interface fa0/0
Switch(config-subif)#encapsulation dot1q 10
!assign as vlan 10 or will communicate with vlan 10
Switch(config-subif)#ip address 10.10.10.1 255.255.255.0
!give ip address
Switch(config)#interface fa0/0.20
!create sub interface 20 in interface fa0/0
Switch(config-subif)#encapsulation dot1q 20
!assign as vlan 20 or will communicate with vlan 20
Switch(config-subif)#ip address 20.20.20.1 255.255.255.0
!give ip address


How to Config DHCP Server

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#ip dhcp pool TESTING
!create DHCP pool with name TESTING
Switch(dhcp-config)#network 10.10.10.0 255.255.255.0
!give subnet that will assign into client
Switch(dhcp-config)#default-router 10.10.10.1
!default gateway for client
Switch(dhcp-config)#dns-server 8.8.8.8
!dns for client
Switch(dhcp-config)#ip dhcp excluded-address 10.10.10.1 10.10.10.10
!config for exclude certain ip from dhcp


How to Config Port-security

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface fa0/1
!go to interface
Switch(config-if)#switchport mode access
!access mode for port
Switch(config-if)#switchport port-security
!activate port security on this port
Switch(config-if)#switchport port-security maximum 1
!config port security to allow only 1 mac-address
Switch(config-if)#switchport port-security mac-address sticky
!mac address will input into running config
Switch(config-if)#switchport port-security violation shutdown
!violation on this port security will make the port into shutdown state


How to configure VTP

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#vtp mode server/client/transparent
!config vtp mode as server, client, or transparent
Switch(config)#vtp domain TESTING
!config vtp domain with TESTING
Switch(config)#vtp password SECRET
!config with password SECRET


How to Reset switch and delete vlan database

! go to enable mode
Switch>enable
Switch#write erase
[confirm] !delete startup config on switch
Switch#delete flash:vlan.dat
!delete vlan database
Switch#reload
[confirm] !reload switch


How to configure STP Portfast

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface fa0/1
!go to interface
Switch(config-if)#spanning-tree portfast
!config STP portfast for interface


How to configure STP Primary/Priority

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#spanning-tree vlan 1 root primary
!will become best priority on vlan 1 regarding the lowest priority on network
Switch(config)#spanning-tree vlan 1 priority 0
!will become the most preferable as root for vlan 1


How to configure L2 Etherchannel LACP

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface range fa0/1-3
!go into interface that will config as etherchannel
Switch(config-if-range)#channel-group 1 mode active
!config as etherchannel group 1 with LACP protocol
Switch(config)#interface port-channel 1
!go to the interface port-channel to continue trunk configuration
Switch(config-if)# switchport mode trunk
!config as trunk
Switch(config-if)#switchport trunk encapsulation dot1q
!config to use dot1q encapsulation


How to configure L2 Etherchannel PAGP

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface range fa0/4-6
!go into interface that will config as etherchannel
Switch(config-if-range)#channel-group 2 mode desirable
!config as etherchannel group 2 with PAGP protocol
Switch(config)#interface port-channel 2
!go to the interface port-channel to continue trunk configuration
Switch(config-if)# switchport mode trunk
!config as trunk
Switch(config-if)#switchport trunk encapsulation dot1q
!config to use dot1q encapsulation


How to configure L3 Etherchannel LACP

! go to enable mode
Switch>enable
Switch#
!
! go to global configuration mode
Switch#config t
Switch(config)#interface range fa0/7-9
!go into interface that will config as etherchannel
Switch(config-if-range)#no switchport
!config port to served as L3 port
Switch(config-if-range)#channel-group 3 mode active
!config as etherchannel group 3 with LACP protocol
Switch(config)#interface port-channel 3
!go to the interface port-channel to continue ip address configuration
Switch(config-if)# no switchport
!config as L3 port
Switch(config-if)#ip address 12.12.12.1 255.255.255.0
!config ip address for port-channel 3

Read more

   CCNA Tutorial

   CCNA Practice Test