第 11 章 排錯方法論與考前衝刺

show 指令地圖:看到症狀就知道下哪一行

把散落在十章裡的指令收攏成一張可以照著查的表。

12 分鐘


介面與實體層

! 最常用的兩行 —— 幾乎每次排錯都從這裡開始
show ip interface brief        ! 所有介面的 IP 與狀態,一眼掃完
show interfaces status         ! 交換器:埠狀態、VLAN、雙工、速率

show interfaces gi0/1          ! 單一介面的完整細節(錯誤計數在這)
show interfaces description    ! 看介面描述,接手別人的網路時很有用
show controllers gi0/1         ! 更底層的實體資訊
看到什麼代表往哪查
administratively down有人下了 shutdownno shutdown
down / down第 1 層問題線、接頭、對端是否開機
up / down第 2 層問題封裝、keepalive、Serial 的 clock rate
up / up 但不通第 3 層以上往路由、ACL、DNS 查
err-disabled被保護機制關閉Port Security 或 BPDU Guard,看日誌

第 2 層:VLAN、Trunk、STP

show vlan brief                ! 有哪些 VLAN、哪些埠在裡面
show interfaces trunk          ! Trunk 狀態、原生 VLAN、允許哪些 VLAN
show mac address-table         ! MAC 學到哪個埠
show spanning-tree             ! 全部 VLAN 的生成樹
show spanning-tree vlan 10     ! 單一 VLAN:誰是 Root、埠角色與狀態
show etherchannel summary      ! 通道是否成功綁定
show cdp neighbors             ! 鄰居是誰、接在哪個埠
show port-security interface fa0/1

第 3 層:路由與定址

show ip route                  ! 路由表(排錯核心)
show ip route 10.1.1.5         ! 這個目的地會走哪條?直接給答案
show ip protocols              ! 跑了哪些路由協定、通告了哪些網段
show ip ospf neighbor          ! OSPF 鄰居狀態
show ip ospf interface brief   ! 每個介面的 OSPF 參數
show ip arp                    ! IP 對 MAC 的對應
show standby brief             ! HSRP 狀態

show ipv6 interface brief
show ipv6 route
show ipv6 neighbors

IP 服務與安全

show ip dhcp binding           ! 發出去哪些位址
show ip dhcp pool              ! 位址池使用率(發完了嗎)
show ip nat translations       ! NAT 轉換表
show ip nat statistics         ! 重點:哪些介面被標記為 inside/outside
show access-lists              ! ACL 內容與 matches 計數
show ip interface gi0/0        ! 這個介面套了哪個 ACL、哪個方向
show ntp status                ! 時間同步了嗎
show logging                   ! 本機日誌緩衝區

設備與設定管理

show version                   ! IOS 版本、開機時間、設定暫存器
show running-config            ! 目前生效的設定
show startup-config            ! 開機會載入的設定
show flash:                    ! 儲存空間內容
show processes cpu sorted      ! CPU 使用率(誰在吃資源)
show inventory                 ! 硬體序號與模組

過濾輸出:讓長輸出變得可讀

這幾個管線技巧能省下大量捲動時間
show running-config | include hostname     ! 只顯示含關鍵字的行
show running-config | exclude ^!           ! 排除註解行
show running-config | section interface    ! 抓出整個區段
show running-config | begin router ospf    ! 從這行開始往下全部顯示

show interfaces | include line protocol    ! 快速掃所有介面狀態
show ip route | include ^O                 ! 只看 OSPF 學來的路由

立即測驗這一節(2 題)