針對 Cisco Catalyst 3548 (IOS 型) 交換機,整理從基本管理、VTP 域、VLAN 建立/刪除、Access/Trunk 埠配置、封裝協定、STP 生成樹調優、PortFast/UplinkFast/BackboneFast/BPDU Filter 等 29 組實務指令,附模式提示符對照,適合網管快速查閱與專案部署參考。
| 模式 | 提示符 | 進入指令 |
|---|---|---|
| 使用者 | Switch> | — |
| 特權 | Switch# | enable |
| 全域配置 | Switch(config)# | configure terminal |
| 介面配置 | Switch(config-if)# | interface fastethernet 0/24 |
| VLAN 資料庫 | Switch(vlan)# | vlan database |
! 啟用 HTTP 管理介面
Switch(config)# ip http server
! 設定主機名
Switch(config)# hostname Switch-PHY-3548
! 特權密碼 (加密/明文)
Switch(config)# enable secret 5 zzz
Switch(config)# enable password zzz
! VTY 遠端密碼
Switch(config)# line vty 0 4
Switch(config-line)# password 7 zzz
Switch(config-line)# login
! 系統時間
Switch# clock set 23:00:00 29 Mar 2009
! 管理 IP (VLAN 1) 與預設閘道
Switch(config)# interface vlan 1
Switch(config-if)# ip address 203.105.1.62 255.255.255.0
Switch(config)# ip default-gateway 203.105.1.1
! 介面描述
Switch(config-if)# description To-Library
! 啟用/關閉埠
Switch(config-if)# no shutdown
Switch(config-if)# shutdown
! 雙工模式
Switch(config-if)# duplex auto ! 或 full / half
! 速率
Switch(config-if)# speed auto ! 或 10 / 100
! 設定 VTP 域名
Switch(config)# vtp domain pku
! 設定 VTP 模式: server / client / transparent
Switch(config)# vtp mode server
Switch# vlan database
Switch(vlan)# vlan 1000 name VLAN1000 ! 新增
Switch(vlan)# no vlan 1000 ! 刪除
Switch(vlan)# vlan 1000 name V1000 ! 修改名稱
Switch(config)# interface fastethernet 0/10
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 248
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q ! 或 isl / negotiate
Switch(config-if)# switchport trunk allowed vlan 10,14,20-30
! 或
Switch(config-if)# switchport trunk allowed vlan except 100-1000
| 功能 | 指令 | 說明 |
|---|---|---|
| 啟用/關閉特定 VLAN STP | spanning-tree vlan 3 / no spanning-tree vlan 3 | 預設啟用 |
| 設定根橋/備援根橋 | spanning-tree vlan 3 root primary / secondary | 自動調優先權為 24576/28672 |
| 手動設定優先權 | spanning-tree vlan 3 priority 8192 | 0-61440,4096 倍數 |
| BackboneFast | spanning-tree backbonefast | 加速間接連結故障收斂 |
| UplinkFast | spanning-tree uplinkfast max-update-rate 32000 / spanning-tree uplinkfast | 接取層快速切換上行 |
| PortFast (全域/單埠) | spanning-tree portfast default / interface 下 spanning-tree portfast | 邊緣埠跳過 Listening/Learning |
| BPDU Filter (全域/單埠) | spanning-tree portfast bpdufilter default | 邊緣埠不送/收 BPDU,防環 |
Switch# show vlan brief
Switch# show interfaces trunk
Switch# show spanning-tree vlan 3 detail
Switch# show spanning-tree summary
Switch# show vtp status
Switch# show running-config
注意:Catalyst 3548 屬較早期機種,部分指令語法與新款 (2960/3560/3850/9000 系列) 略有不同,實務上請以 ? 線上說明為準。