CISCO Switch Commands
From KlavoWiki
Factory Reset
enable erase startup-config
or
enable write erase
Switch IP Address
Default IP
enable configure terminal ! interface vlan 1 ip address 192.168.1.111 255.255.255.0 no shutdown exit
Default Gateway
enable configure terminal ! ip default-gateway 192.168.1.254 exit
Default Name Servers
enable configure terminal ! ip default-name 8.8.8.8 exit
Clock
Set
enable ! clock set 18:56:00 10 Feb 2017 ! configure terminal clock timezone GMT 10
NTP
????
Show
enable show clock
Interfaces
Show
Interfaces
show interface FastEthernet 0/1 ! show ip interface brief
MAC Address
show mac-address ! show mac-address interfaces fastEthernet 0/1
VLAN's
Creation
There are two type of VLANs. Interface and non Interface. Interface VLANs mean the switch can pass traffic between VLANs otherwise a router will be required.
enable configure terminal ! vlan 10 name Corporate ! vlan 20 name Test exit
VLAN IP
enable configure terminal ! interface vlan 10 ip address 192.168.11.100 255.255.255.0 no shutdown ! interface vlan 20 ip address 192.168.15.100 255.255.255.0 no shutdown exit
Ports
enable configure terminal ! interface fa0/1 switchport mode access siwthcport access vlan 10 exit interface fa0/2 switchport mode access siwthcport access vlan 20 exit interface fa0/3 switchport mode access siwthcport access vlan 30 exit ! interface range fa0/10-20 switchport mode access siwthcport access vlan 20 exit ! interface range fa0/21-24 switchport mode access siwthcport access vlan 30 exit
Multiple VLAN on Single Interface
enable configure terminal ! vlan 10 name Corporate exit vlan 20 name Wireless exit vlan 30 name Test exit ! interface gigabitEthernet 0/0 no shutdown ! interface gi0/0.10 encapsulation dot1Q 10 ip address 192.168.1.254 255.255.255.0 ! interface gi0/0.20 encapsulation dot1Q 20 ip address 192.168.2.254 255.255.255.0 ! interface gi0/0.30 encapsulation dot1Q 30 ip address 192.168.3.254 255.255.255.0 ! exit
Trunk Port
enable configure terminal ! interface FastEthernet 0/1 switchport mode trunk exit
VLAN's Show
show vlan brief ! show vlan id 10 ! show vlan id 20 ! exit
Disable DNS Lookups
If you accidentally type in a command the is not recognised the switch will try to do a DNS lookup. To disable this.
enable configure terminal ! no ip domain lookup exit
CDP (CISCO Discovery Protocol)
Enable
enable configure terminal ! cdp run
Disable
enable configure terminal ! no cdp run
Show Neighbours
show cdp neighbours ! show cdp entry NAME
Spanning Tree
Change Root
spanning-tree vlan 1 root primary
or set priority level (multiple of 4096)
spanning-tree vlan1 priority xxxxxx
Disable/Portfast
At a global level
enable configure terminal ! spanning-tree portfast default
On a particular interface
enable configure terminal ! interface FastEthernet 0/11 spanning-tree portfast default exit
Rapid Spanning Tree
On all switches
spanning-tree mode rapid-pvst
Show
show spanning-tree show spanning-tree summary show spanning-tree detail
Syslog
logging host 192.168.1.1