Switching

Useful Cisco CLI commands

Create a Vlan:
Switch# enable
Switch# config t
Switch (config)# vlan 10
Switch (config-vlan)# end
Assign or change IP to a VLAN:
Switch# enable
Switch# config t
Switch (config)# int vlan10
Switch (config-if)# ip address 10.10.10.10 255.255.255.0
Switch (config-if)# no shut
Disable/Enable a port:
Switch# enable
Switch# configure terminal
Switch(config)# interface Gi1/0/3
Switch(config-subif)# no shutdown (enable)
Switch(config-subif)# shutdown (disable)
Switch(config-subif)# end
Assign/Change a VLAN to a port (first time will assign, next time on the same port will change it to another VLAN):
Switch# configure terminal
Switch(config)# interface Gi1/0/6
Switch(config-if)# shutdown
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 200
Switch(config-if)# no shutdown
Switch(config-if)# end
Assign a VLAN to multiple ports:
Switch# configure terminal
Switch(config)# interface Gi1/0/2-40
Switch(config-if)# shutdown
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 200
Switch(config-if)# no shutdown
Switch(config-if)# end
Change a port to trunk of more VLANs:
Switch# configure terminal
Switch(config)# interface Gi1/0/3
Switch(config-if)# switch access vlan 10
Switch(config-if)# switch trunk native vlan 10
Switch(config-if)# switch trunk allowed vlan 10,20,30,40
Switch(config-if)# switch mode trunk
Switch(config-if)# end
Show one interface, one Vlan or all – running config:
Switch# show run int Eth1/20 [Or Gi1/0/20] -> will show only interface Eth1/20 [or Gi1/0/20]
Switch# show run int Vlan20 -> will show only Vlan 20
Switch# show run -> will show all interfaces and Vlans
Configure DHCP using the 192.168.1.0/24 network ID:
Switch# configure terminal
Switch(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10
Switch(config)#ip dhcp pool IT_Dept
Switch(dhcp-config)#network 192.168.1.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.1.1
Switch(dhcp-config)#dns-server 4.4.4.4
Switch(dhcp-config)#lease 3 12 15
Switch(dhcp-config)# end
Save configuration:
Switch# copy running-config startup-config
Switch# reload
Backup config file:
Switch# copy running-config tftp
Switch# IP for the TFTP server
Switch# File name [you can press ENTER, because will show the file]
Restore config file:
Switch# copy tftp: startup-config
Switch# IP for the TFTP server [host with the backup file]
Switch# Source file [name of the backup file]
Switch# Destination file [startup-config default file]
Switch# reload
avramuta.com - All rights reserved.
Wordpress Themes
Scroll to Top