rss logo

The Cisco Switching Small Business / SG main commands

Cisco logo

Configuration

  • Switch model : Cisco SG550X
  • Switch model : Cisco SG350X
  • Switch model : Cisco CBS250

Commands

Show

  • Get firmware version:
Cisco# show version
  • Get serial number:
Cisco# show system id
  • Get model, uptime, hostname, MAC Address:
Cisco# show system unit 1
  • Get mac address:
Cisco# show mac address-table
  • Get gbic (sfp module) informations:
Cisco# show inventory
  • Show last logs:
Cisco# show logging
  • Show learned ip addresses:
Cisco# show arp

User Account Management

  • Change password:
Cisco(config)# username cisco password myNEWpassword
  • Add admin user:
Cisco(config)# username cisco privilege 15 password myNEWpassword
  • Disable password maximum lifetime:
Switch(config)# password aging 0

Misc

  • Change hostname:
Cisco(config)# hostname Switch
  • Save current config:
Switch# copy running-config startup-config Switch# write
  • Set switch ip:
Switch(config)# interface vlan1 Switch(config-if)# ip address 192.168.1.100 255.255.255.0 Switch(config-if)# no ip address dhcp
  • Set dns:
Switch(config)# ip name-server 192.168.1.110
  • Disable DNS lookup feature for unknown commands:
Switch(config)# no ip domain lookup
  • Add ip gateway:
Switch(config)# interface vlan1 Switch(config-if)# ip default-gateway 192.168.1.254
  • Reboot:
Switch# reload
  • Interface range (use gi1, gi2 etc… for CBS series):
Switch(config)# interface range ge1/0/4,ge1/0/30 Switch(config)# interface range ge1/0/4-18
  • Enable ssh server:
Switch(config)# ip ssh server
  • Disable http server:
Switch(config)# no ip http server
  • Disable Bonjour:
Switch(config)# no bonjour enable
  • Disable PNP:
Switch(config)# no pnp enable
  • Check cpu utilization:
Switch# show cpu utilization
  • Globally disable the M#@!€*£cking auto smartport (port autoconfiguration) for CBS series:
Switch(config)# no macro auto
  • Erase configuration, do a factory reset:
Switch(config)# delete startup-config
  • Disable the logging of system messages and events to the console interface:
Switch(config)# no logging console

Import/Export Config

  • Upload config to tftp server:
Switch# copy run tftp://tftp_server/YYYY-MM-DD
  • Import config from tftp server:
Switch# copy tftp://tftp_server/YYYY-MM-DD run

Update Firmware

Easy method

  • Upload new firmware:
Switch# boot system tftp://tftp_server/firmware.bin
  • Reboot to load new firmware:
Switch# reload

Normal method

  • Upload new firmware:
Switch# copy tftp://tftp_server/firmware.bin flash://system/images/
  • Get available firmwares:
Switch# show bootvar
  • Enable new firmware:
Switch# boot system image-2
  • Reboot:
Switch# reload

PoE

  • Turn off PoE:
Switch(config)# interface gi1/0/1 Switch(config-if)# no power inline
  • Turn on PoE:
Switch(config)# interface gi1/0/1 Switch(config-if)# power inline auto
  • Get PoE informations:
Switch# show power inline Switch# show power inline gi1/0/1

VLAN

  • Add a VLAN:
Switch(config)# vlan database Switch(config-vlan)# vlan 4 Switch(config)# interface vlan 4 Switch(config-if)# name VoIP
  • Set the access VLAN to an interface:
Switch(config)# interface GigabitEthernet 1/24 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan4
  • Configure the allowed VLAN to a Trunk interface:
Switch(config)# interface te 1/0/1 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk allowed vlan none Switch(config-if)# switchport trunk allowed vlan add 4,100,101,150

Locked Port / Disable port security

Message : Your port has port security enable and has noticed that the MAC address on that port is different from what the port had originally learned.

Switch# set interface active gi2/0/4 Switch# show ports security gi2/0/4 Switch(config) # interface gi2/0/4 Switch(config-if)# no port security

sFlow

  • Set sFlow:
Switch(config)# sflow receiver <index of the receiver> <sflow receiver ip> port 2055 Switch(config)# interface range GigabitEthernet1/0/1-48 Switch(config-if-range)# sflow flow-sampling 1024 1 Switch(config-if-range)# sflow counters-sampling 600 1
  • Disable sFlow:
Switch(config)# interface TengigabitEthernet1/0/1 Switch(config-if)# no sflow counters-sampling Switch(config-if)# no sflow flow-sampling

Port Mirroring / SPAN

  • Set mirroring on GigabitEthernet1/0/1:
Switch(config)# monitor session 1 destination interface GigabitEthernet1/0/1
  • With GigabitEthernet1/0/2 and GigabitEthernet1/0/3 traffic:
Switch(config)# monitor session 1 source interface GigabitEthernet1/0/2 both Switch(config)# monitor session 1 source interface GigabitEthernet1/0/3 both

NTP

  • Show current time:
Switch# show clock
  • Show ntp status:
Switch# show sntp status
  • Set ntp (you should configure network access first):
Switch(config)# clock source sntp Switch(config)# sntp unicast client enable Switch(config)# sntp server 0.pool.ntp.org

Spanning Tree

  • Show spanning tree configuration:
Switch# show spanning-tree
  • Set current switch as root bridge:
Switch(config)# spanning-tree priority 4096
  • Use RTSP (Rapid Spanning Tree Protocol) mode:
Switch(config)# spanning-tree mode rstp

Configure Stack

Stack two SG switches

Note: When stacking two SG switches, it's essential to ensure that both the models and firmware are the same.

Cisco stack between two switchs

Switch01

  • Enter the context of Stack Unit 1:
Switch01(config)# stack unit 1
  • Set the Unit ID to 1 (Master):
Switch01(unit)# stack configuration links te1-2 unit-id 1
  • Save the configuration:
Switch01(unit)# do write
  • Restart:
Switch01(unit)# do reload

Switch02

  • Enter the context of Stack Unit 1:
Switch02(config)# stack unit 1
  • Set the Unit ID to 2:
Switch02(unit)# stack configuration links te1-2 unit-id 2
  • Save the configuration:
Switch02(unit)# do write
  • Restart:
Switch02(unit)# do reload

Show commands

  • Display the stack configuration:
Stack# show stack configuration Unit Id After Reboot Configuration Unit Id Stack Links -------- ------- --------------- 1 1 te1-2 2 2 te1-2
  • Display the stack settings:
Stack# show stack Topology is Chain Units stack mode: Native Unit Id MAC Address Role Network Uplink Port Port Type Type ------- ------------------- ---------- ------- ------ 1 40:a6:e8:e6:9c:11 active gi te 2 40:a6:e8:e6:9c:12 standby gi te
  • Display the stack information for an entire stack:
Stack# show stack links details Topology is Chain UNIT ID Link Status Speed Neighbor Neighbor Neighbor Unit ID Link MAC Address ------- -------- ---------- ----- -------- -------- ------------------- 1 te1 Active 10G 2 te2 40:a6:e8:e6:9c:12 1 te2 Active 10G 2 te1 40:a6:e8:e6:9c:12 2 te1 Active 10G 1 te2 40:a6:e8:e6:9c:11 2 te2 Active 10G 1 te1 40:a6:e8:e6:9c:11

Remove stack configuration

  • Remove the stack configuration settings:
Switch01(config)# stack unit 1 Switch01(unit)# no stack configuration
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address