CISCO Switch Commands

From KlavoWiki
Jump to navigationJump to search

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

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

Channels

LAG

interface fa0/14
channel-protocol lacp
channel-group 1 mode active
!
interface fa0/15
channel-protocol lacp
channel-group 1 mode active
exit
!
interface port-channel 1
switchport mode access
switchport access vlan 10


Trunk

enable
configure terminal
!
interface range FastEthernet 0/21-24
channel-protocol lacp
channel-group 1 mode active
!
interface port-channel 11
switchport mode trunk

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

SNMP

enable
configure terminal
!
snmp-server community test ro
exit