典型症狀 -> 高機率原因

  • PC 拿到 IP,但 ping 唔到 gateway:port VLAN 錯 / trunk 漏 VLAN / gateway SVI 落錯 VLAN
  • 同一 VLAN 內互 ping 唔到:STP block / port-security / 實際唔同 VLAN
  • 新加咗 VLAN,但某層/某房間用唔到:uplink trunk allowed list 冇開新 VLAN

必備 show(10 秒定位)

TEXT
 show interfaces status show vlan brief show interfaces trunk show spanning-tree vlan <vlan-id> show mac address-table dynamic | include Gi|Fa 

你要確認三件事: 1) 用戶 port 是否 access,而且 access vlan 正確 2) uplink 是否 trunk,且允許該 VLAN 3) 是否有 STP blocking(loop/錯線常見)

常用配置(慎用,改前先確認 port 連到咩)

Access port(接 PC/Printer)

TEXT
 conf t interface gi1/0/10 switchport mode access switchport access vlan 20 spanning-tree portfast end wr mem 

Trunk port(接上游交換機/路由器/AP uplink)

TEXT
 conf t interface gi1/0/1 switchport mode trunk switchport trunk allowed vlan 10,20,30 end wr mem 
筆記
註:不同設備可能用 switchport trunk allowed vlan add 20(看你現場慣例)。

變更後驗證(必做)

TEXT
 show interfaces trunk show vlan brief 
TEXT
 ipconfig ping <gateway> 

Windows 端:

超常見坑(做單最易中招)

  • 將 uplink 誤設成 access(整層斷)
  • trunk allowed list 漏 VLAN(表面 trunk 但實際唔通)
  • Portfast 用錯在 trunk(依環境,可能引起 STP 問題)