Several years ago I created my own Cisco switch and router basic config command references as word docs. However I find my info more useful on the Internet to find, and for anyone else to make use of.

Here is the switch related reference doc I created.

 

 

 

 

BASIC DEVICE COMMANDS

 

Show Running Configuration File

#show running-config

 

Show Startup Configuration File (NVRAM)

#show startup-config

 

Copy Changes from Running Config to the Startup Config

#copy running-config startup-config

 

Show Version (Platform Type / OS Revision / Last Boot / Memory / Interfaces / Conf Register)

#show version

 

 

BASIC SETINGS

 

Set a Warning Banner for Login Prompt

>enable

#configure terminal

#banner motd &

#banner line1

#banner line2 &

#exit

 

Set hostname

>enable

#configure terminal

#hostname router1

#exit

 

 

DEVICE SECURITY

 

Set Password and Level for Exec & Non-Exec Access (>enable

#configure terminal

#enable password level 15 EnablePass1

 

Set Level and Secret Password Access (recommended method)

>enable

#configure terminal

#enable secret level 15 EnableSecret1

#exit

 

 

SAVING AND RESTORING CONFIGURATIONS

 

Save Running Config to Startup Config

#copy running-configuration startup-configuration

 

Save Running Config to a Remote TFTP Server

#copy running-configuration tftp

<enter IP>

<enter filename>

 

Save Config From Remote TFTP Server to the Running Config

#copy tftp running-configuration

<enter IP>

<enter filename>

 

Delete NVRAM

#delete nvram

 

 

INFORMATIONAL COMAMNDS

 

Show Spanning Tree Information (port cost/hello interval/root bridge address)

>show spantree

 

 

MAC ADDRESSES

 

Show Mac Address Table (Shows which Devices are Connected to which Port)

>show mac-address-table

 

Permanently Assign a Device MAC Address to a Port

#conf term

(config)#mac-address-table permanent 1111-1111-1111 e0/5

(config)#mac-address-table static 3333.3333.3333.3333 vlan 1 int fa0/3

 

Clear Mac Address Table

#clear mac-address-table

 

Configure Port Security to “Sticky Learn” the MAC Address Connected and only Allow that Device to Connect

1900

#conf term

(config)#int e0/5

(config-if)#port secure

(config-if)#port secure max-mac-count 1

 

2950

#conf term

(config)#interface fa0/3

(config-if)#switchport port-security

(config-if)#switchport mode access

(config-if)#switchport port-security maxumim 1

 

 

VLANS

 

Show VLAN

>show vlan

 

Show Port VLAN Membership Information

>show vlan-membership

 

Show VLAN Interface Information

>show interface vlan 1

 

 

Create VLANs

#conf term

(config)#vlan 30 name desktops

(config)#vlan 25 name servers

(config)#vlan 20 name printers

OR

#vlan database

(vlan)#vlan 10 name testing

(vlan)#vlan 12

 

Removing VLANs

#conf term

(config)#no vlan 30

(config)#no vlan 25 name servers

(config)#no vlan 20 printers

OR

#vlan database

(vlan)#no vlan 10

(vlan)#no vlan 12

 

Assigning a VLAN to a Single Port

1900

#conf term

(config)#interface fa0/0

(config-if)#vlan-membership static 30

 

2950

#conf term

(config)#interface fa0/0

(config-if)#switchport mode access

(config-if)#switchport access vlan 40

 

Removing a Single Port VLAN Assignment (Defaults Back to VLAN 1)

1900

#conf term

(config)#interface fa0/0

(config-if)#no vlan-membership static 30

 

Assign a VLAN to a Range of Ports

1900

#conf term

(config)#interface range fast 0/2 – 5

(config-if)#switchport access vlan 30

 

Assign an IP to a VLAN

1900

#conf term

(config)#interface vlan 1

(config-if)#ip address 10.0.1.1 255.255.255.0

 

 

VTP (Virtual Trunking Protocol)

 

Show VTP Status

>show vtp status

 

Show Trunk Information (1900)

>show trunk a

>show trunk b

 

Set the VTP Domain

#conf term

(config)#vtp domain mydomain

 

#vlan database

(config)#vtp domain mydomain

 

Set Switch as a VTP Server

#vlan database

(vlan)#vtp server

(vlan)#vtp domain mydomain

(vlan)#vtp password mypass1

 

Set Switch as a VTP Client

#vlan database

(vlan)#vtp client

(vlan)#vtp domain mydomain

(vlan)#vtp password mypass1

 

 

Trunk Link

Create Trunk Link that will Carry the VLAN Configurations

SW1#conf term

SW1(config)#interface fast 0/24

SW1(config-if)#switchport mode trunk

 

SW2#conf term

SW2(config)#interface fast 0/24

SW2(config-if)#switchport mode trunk

 

 

 

 

Dynamic Trunk Link 

Create a Dynamic Trunk Link that will Carry the VLAN Configurations

SW1#conf term

SW1(config)#interface fast 0/24

SW1(config-if)#switchport mode dynamic desirable

 

SW2#conf term

SW2(config)#interface fast 0/24

SW2(config-if)#switchport mode dynamic desirable

 

 
Configure a switchport interface for Trunk mode with a specific allowed VLAN
conf t
interface GigabitEthernet1/0/5
description server5
switchport trunk allowed vlan 123
switchport mode trunk
duplex full
spanning-tree portfast trunk
spanning-tree bpduguard enable


Configure a switchport interface range for Trunk mode with specific allowed VLAN ranges
conf t
interface range GigabitEthernet1/0/10-20
description vSphere-Cluster-ESXi-Servers
switchport trunk allowed vlan 100-123,200,50-60
switchport mode trunk
duplex full
spanning-tree portfast trunk
spanning-tree bpduguard enable

 
 

Share this blog post on social media:

Social Links

Disclaimer

All advice, installation/configuration how to guides, troubleshooting and other information on this website are provided as-is with no warranty or guarantee. Whilst the information provided is correct to the best of my knowledge, I am not reponsible for any issues that may arise using this information, and you do so at your own risk. As always before performing anything; check, double check, test and always ensure you have a backup.

Copyright ©2008-2021 Andy Barnes - Please do not copy any content including images without prior consent!

Designed and Hosted by Andy Barnes

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.