增加知识文档

This commit is contained in:
hans 2026-07-21 19:01:49 +08:00
parent f3152acb88
commit db1d89d83b
11 changed files with 1461 additions and 0 deletions

View file

@ -0,0 +1,34 @@
# 06_标准SOP与工具脚本
## 定位
沉淀常用排障命令组合、自动化脚本和标准化操作流程(SOP),解决"具体敲什么命令"的问题。这是最贴近实战的操作手册。
## 内容要求
- **命令速查卡**:将复杂排障流程浓缩为3-5步关键命令
- **自动化脚本**:Python/Shell脚本,一键采集诊断信息
- **抓包与解码规范**:协议报文的捕获方法和关键字段解析
- **检查清单(Checklist)**:重大变更或故障处理的标准步骤
## 目录结构
```
06_标准SOP与工具脚本/
├── MPLS标签排障命令速查.md
├── BGP跨域故障排查SOP.md
├── OSPF邻居异常快速诊断.md
├── 抓包与解码规范.md
└── 自动化采集脚本/
├── collect_bgp_info.py
└── check_mpls_labels.sh
```
## RAG作用
当用户说"帮我执行BGP排障"或"运行MPLS标签检查"时,AI直接调用这里的命令组合或脚本。
## 与01_协议排障逻辑树的区别
- 01文件夹讲"排查思路"(If...Then...决策树)
- 本文件夹讲"操作动作"(具体执行哪些show/debug命令)
## 最佳实践
- 每个SOP不超过一页A4纸,便于打印携带
- 命令附带"期望输出"和"异常判定标准"
- 脚本具备自解释能力(含帮助信息和示例)

View file

@ -0,0 +1,400 @@
# 命令探索方法论:通过 `?` 在线帮助发现真实命令
## 为什么需要命令探索?
在实际网络运维中,我们经常遇到以下问题:
- **文档过时**:厂商设备版本升级后命令语法变化
- **记忆模糊**:记不清完整命令路径和参数格式
- **设备差异**:不同厂商(ZTE/Huawei/Cisco)命令体系不同
- **上下文依赖**:某些命令只在特定模式下可用
**解决方案**:使用设备内置的 `?` 在线帮助系统,像"剥洋葱"一样逐层探索。
---
## 核心原则:从宽到窄,逐步细化
### 探索路径示例:以BGP VPNv4路由查询为例
#### 第一步:确定顶层命令
```bash
MER1#show ?
```
输出会列出所有 `show` 开头的命令类别:
```
bgp Show BGP information
ip Show IP information
mpls Show MPLS information
isis Show IS-IS routing information
...
```
#### 第二步:进入子命令层级
```bash
MER1#show bgp ?
```
输出显示BGP相关的地址族:
```
ipv4 IPv4 address family
vpnv4 VPNv4 address family
evpn Display information about all EVPN NLRIs
...
```
#### 第三步:继续深入具体类型
```bash
MER1#show bgp vpnv4 ?
```
输出显示VPNv4的单播/组播分类:
```
unicast Display information about all VPNv4 NLRIs
multicast Display information about all VPNv4 multicast NLRIs
flowspec Flow specification address family modifier
...
```
#### 第四步:查看可用的操作符和参数
```bash
MER1#show bgp vpnv4 unicast ?
```
**关键输出**(这是最有价值的一步):
```
as Autonomous system
community Show route community information
dampened-paths Show paths suppressed due to dampening
detail Display detailed information about an ip prefix
flap Show flap info
in Show route information received from all neighbors
labels Display BGP labels for prefixes
neighbor Detailed information on TCP and BGP neighbor connections
network Show route information
rd Specify route distinguisher
rd-by-vrf Specify route distinguisher by VRF name
vrf Display information for a VPN Routing/Forwarding instance
| Output modifiers (管道符,用于过滤)
> Redirect the output to a file (重定向到文件)
<cr> Carriage return (直接回车执行)
```
#### 第五步:选择VRF相关选项继续探索
```bash
MER1#show bgp vpnv4 unicast vrf ?
```
输出显示可用的VRF实例名称:
```
5G_MEC VPN Routing/Forwarding instance name
IP_RAN VPN Routing/Forwarding instance name
test VPN Routing/Forwarding instance name
WORD VPN Routing/Forwarding instance name (任意字符串)
```
#### 第六步:查看VRF下的具体操作
```bash
MER1#show bgp vpnv4 unicast vrf test ?
```
最终得到精确命令:
```
detail Show route detail information
export-unicast Export VRF routes to unicast routing table
import-unicast Import unicast routes to VRF routing table
in Show route information received from all neighbors
labels Display BGP labels for prefixes
local Display local information of a BGP neighbor
neighbor Detailed information on TCP and BGP neighbor connections
policy Display information about bgp advertisements under a proposed policy
received Display information received from a BGP neighbor
route Show route information ← 这就是我们要的!
summary Summary of BGP neighbor status
```
#### 第七步:执行最终命令
```bash
MER1#show bgp vpnv4 unicast vrf test route
```
输出完整的BGP VPNv4路由表:
```
15:21:26 Beijing Mon Jul 20 2026
Current AS: 100. Other AS: 64580, 64600, 64900
Status codes: * valid, > best, i - internal, s - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf RtPrf Path
```
---
## 实战案例:探索Ping和Trace命令
### 案例1:VRF环境下的Ping命令
#### 探索过程记录
```bash
# 第1层:ping后面可以跟什么?
MER1#ping ?
A.B.C.D Target IP address
bier Send BIER echo messages
ce Customer edge
dcn DCN VRF
domain Domain name
evpn Send EVPN echo messages
mpls Send MPLS echo messages
satellite Specify satellite ID
vpls VPLS instance
vpws Kompella VPWS
vrf VPN Routing/Forwarding instance name
# 第2层:ping vrf后面跟什么?
MER1#ping vrf ?
5G_MEC VRF name (1-32 characters)
5G_OAM VRF name (1-32 characters)
IP_RAN VRF name (1-32 characters)
test VRF name (1-32 characters)
WORD VRF name (1-32 characters)
# 第3层:ping vrf test后面跟什么?
MER1#ping vrf test ?
A.B.C.D Target IP address
domain Domain name
# 第4层:执行完整命令
MER1#ping vrf test 4.1.1.1
sending 5,100-byte ICMP echo(es) to 4.1.1.1,timeout is 2 second(s).
.....
Success rate is 0 percent(0/5).
```
### 案例2:探索MPLS LDP邻居查询
```bash
# 第1层:mpls ldp后面有什么?
MER1#show mpls ldp ?
backoff Show LDP session setup backoff table
bindings Show the LDP label information base (LIB)
discovery Show sources for locally generated LDP discovery hello PDUs
graceful-restart Show MPLS LDP GR
iccp Show LDP session and ICCP state information
igp Show LDP IGP synchronization status
instance Show LDP instance information
interface Show per-interface LDP forwarding information
log Show LDP log info
neighbor Show LDP neighbor information ← 目标在这里
parameters Show LDP configuration parameters
# 第2层:neighbor后面有什么?
MER1#show mpls ldp neighbor ?
A.B.C.D Neighbor address
brief Brief neighbor information ← 要这个简洁版
bvi Bvi interface
detail Detailed neighbor information
graceful-restart The information of LDP graceful restart neighbor
instance The information of LDP instance ← 还可以指定实例
# 第3层:instance后面跟什么?
MER1#show mpls ldp neighbor brief instance ?
<1-65535> LDP instance id
# 第4层:执行完整命令
MER1#show mpls ldp neighbor brief instance 1
15:20:54 Beijing Mon Jul 20 2026
Codes: D:Direct, T:Targeted, D&T:Direct&Targeted
Total number of neigbors:0
Operational:0 (D:0,T:0,D&T:0) (IPv4:0,IPv6:0,IPv4&IPv6:0)
Not operational:0 (D:0,T:0,D&T:0) (IPv4:0,IPv6:0,IPv4&IPv6:0)
```
---
## 高级技巧:组合使用 `?` 和其他工具
### 技巧1:利用 `<cr>` 提示判断命令完整性
当 `?` 输出中包含 `<cr>` 时,表示当前命令已经完整,可以直接执行:
```bash
MER1#show mpls ldp neighbor brief instance 1 ?
<cr> ← 看到这个,就知道可以直接回车执行了
```
### 技巧2:使用管道符 `|` 过滤大量输出
当某个命令输出太多时,用 `?` 查看可用的过滤选项:
```bash
MER1#show bgp vpnv4 unicast vrf test route ?
| Output modifiers
MER1#show bgp vpnv4 unicast vrf test route | ?
begin Begin with the line that matches
count Count the number of lines that match
exclude Exclude lines that match
include Include lines that match
section Print only the section that matches
# 实际应用:只看包含特定前缀的路由
MER1#show bgp vpnv4 unicast vrf test route | include 4.1.1
```
### 技巧3:在配置模式下同样适用
`?` 不仅适用于特权模式(`#`),也适用于配置模式(`(config)#`):
```bash
MER1#configure terminal
MER1(config)#router bgp 100
MER1(config-bgp-router)#neighbor ?
A.B.C.D Neighbor IPv4 address
X:X::X:X Neighbor IPv6 address
peer-group Name of peer group
MER1(config-bgp-router)#neighbor 10.26.63.152 ?
activate Enable the neighbor
advertisement-interval Set minimum interval between sending routing updates
allowas-in Allow AS in path
...
next-hop-self Disable the next hop calculation for this neighbor ← 关键配置!
...
```
### 技巧4:识别命令缩写规则
通过 `?` 可以发现命令的简写形式:
```bash
MER1#sh ?
show Show running system information
MER1#show mpls forw ?
forwarding-table Show MPLS forwarding-table information ← forw是forwarding的合法缩写
```
**规律**:只要输入的字母能唯一标识一个命令,就可以缩写。例如:
- `show` → `sh`
- `forwarding-table` → `forw`
- `configuration` → `conf`
---
## 常见命令树结构对比
### ZTE vs Huawei vs Cisco
| 功能 | ZTE (ZXROS) | Huawei (VRP) | Cisco (IOS) |
|------|-------------|--------------|-------------|
| 查看BGP VPNv4路由 | `show bgp vpnv4 unicast vrf <name> route` | `display bgp vpnv4 routing-table vpn-instance <name>` | `show bgp vpnv4 unicast vrf <name>` |
| 查看MPLS转发表 | `show mpls forwarding-table` | `display mpls lsp` | `show mpls forwarding-table` |
| 查看LDP邻居 | `show mpls ldp neighbor brief instance 1` | `display mpls ldp session` | `show mpls ldp neighbor` |
| Ping VRF内地址 | `ping vrf <name> <ip>` | `ping -vpn-instance <name> <ip>` | `ping vrf <name> <ip>` |
**结论**:虽然命令相似,但细节有差异。**必须针对每种设备单独探索**。
---
## 错误处理与注意事项
### 注意1:命令前缀限制
某些平台可能限制特定命令的使用:
```bash
# 如果收到 "command_not_allowed_prefix" 错误
MER1#trace vrf test 4.1.1.1
%Error: command_not_allowed_prefix
```
**原因**:`trace` 命令可能被netx等平台限制。此时应尝试:
- 改用完整路径 `traceroute`
- 检查权限级别
- 使用替代命令(如通过ping逐跳测试)
### 注意2:区分"不完整命令"和"无匹配"
```bash
# 不完整命令(Incomplete command)- 说明方向对,继续用?探索
MER1#show bgp vpnv4 unicast vrf test
%Error 140305: Incomplete command.
# 无匹配(Unrecognized command)- 说明走错路了,退回上一层
MER1#show bgp vpnv4 unicast vrf test xyz
%Error: Unrecognized command.
```
### 注意3:空格敏感性
```bash
# 正确:每个层级之间有空格
MER1#show mpls ldp neighbor brief instance 1
# 错误:连在一起会当成一个单词
MER1#show mplsldpneighborbriefinstance1
%Error: Unrecognized command.
```
---
## 练习:自主探索以下命令
请用 `?` 方法探索下列命令的完整语法(答案不唯一):
1. 查看ISIS邻接关系
2. 查看OSPF邻居详细信息
3. 查看VRF IP_RAN的路由表
4. 查看MPLS标签绑定信息
5. 查看BGP从邻居10.26.63.152收到的路由
**参考答案**(实际以设备为准):
```bash
# 1. ISIS邻接
MER1#show isis adjacency
# 2. OSPF邻居详细
MER1#show ip ospf neighbor detail
# 3. VRF IP_RAN路由
MER1#show ip forwarding route vrf IP_RAN
# 4. MPLS标签绑定
MER1#show mpls ldp bindings
# 5. BGP从邻居收到的路由
MER1#show bgp vpnv4 unicast vrf test received 10.26.63.152
```
---
## 总结:命令探索五步法
1. **定方向**:从最顶层开始(`show ?`, `ping ?`, `configure ?`)
2. **剥洋葱**:每层用 `?` 查看下一级选项,选择最相关的分支
3. **看提示**:注意 `<cr>`、`WORD`、`A.B.C.D` 等元提示
4. **试执行**:看到 `<cr>` 就执行,观察输出验证猜测
5. **记笔记**:把成功的命令路径记录下来(就像本文档做的)
**终极心法**:不要怕敲错,`?` 永远不会嘲笑你。每个网络专家都是从不停地敲 `?` 开始的。
---
## 附录:快速参考卡片
```bash
# 通用探索模板
<command> ? # 查看下一级选项
<command> <subcommand> ? # 继续深入
...
<full-command> <cr> # 看到<cr>就可以执行
# 特殊符号含义
<cr> - 可以直接回车执行
WORD - 任意字符串(通常是名字、ID等)
A.B.C.D - IPv4地址格式
X:X::X:X - IPv6地址格式
<1-65535> - 数字范围
| - 管道符,用于过滤输出
> - 重定向到文件
# 经典命令树深度
show bgp vpnv4 unicast vrf <name> route # 7层
show mpls ldp neighbor brief instance <id> # 6层
ping vrf <name> <ip> # 4层
configure terminal # 2层
```
---
**文档版本**:v1.0
**最后更新**:2026-07-20
**维护者**:基于真实设备(MER1)验证

View file

@ -0,0 +1,245 @@
# 故障处理常用命令目录集(ZTE ZXROS)
> **设备**:MER1 @ 10.229.234.136 (ZXCTN 9000-3EA, V5.00.10.70)
> **更新时间**:2026-07-20
> **验证状态**:✅ 已验证 / ❌ 错误命令(已删除)
---
## 一、BGP相关命令
### 1.1 BGP IPv4单播
```bash
show bgp ipv4 unicast # BGP IPv4单播路由表
show bgp ipv4 unicast summary # BGP IPv4摘要信息
```
### 1.2 BGP VPNv4
```bash
show bgp vpnv4 unicast # VPNv4 BGP路由表(所有VRF)
show bgp vpnv4 unicast summary # VPNv4 BGP摘要
show bgp vpnv4 unicast vrf <vrf-name> route # 指定VRF的VPNv4路由表
show bgp vpnv4 unicast vrf <vrf-name> # 指定VRF的VPNv4路由(Incomplete command,需要加route)
```
### 1.3 BGP配置查看
```bash
show running-config bgp # BGP运行配置
show running-config router bgp <as-number> # BGP进程配置
```
### 1.4 BGP IPv4单播详细
```bash
show bgp ipv4 unicast neighbor # BGP IPv4邻居信息
show bgp ipv4 unicast neighbor <ip-address> # 指定邻居的详细信息
```
---
## 二、IGP相关命令
### 2.1 IS-IS
```bash
show isis adjacency # IS-IS邻接关系
show isis database # IS-IS链路状态数据库
show isis hostname # IS-IS动态主机名映射
show isis circuit # IS-IS电路信息
```
### 2.2 OSPF
```bash
show ip ospf neighbor # OSPF邻居关系
show ip ospf interface brief # OSPF接口简要信息
show ip ospf interface # OSPF接口详细信息
show ip ospf database # OSPF链路状态数据库
show ip ospf database router-link # OSPF Type-1 LSA(Router LSA)
show ip ospf database network # OSPF Type-2 LSA(Network LSA)
show ip ospf database summary # OSPF Type-3 LSA(Summary LSA)
show ip ospf database asbr # OSPF Type-4 LSA(ASBR Summary LSA)
show ip ospf database external # OSPF Type-5 LSA(External LSA)
show ip ospf database nssa # OSPF Type-7 LSA(NSSA External LSA)
show ip ospf database self-originate # OSPF自生成的LSA
show ip ospf border-routers # OSPF边界路由器信息
show ip ospf virtual-links # OSPF虚链路信息
show ip ospf # OSPF进程概要信息
show ip ospf route # OSPF路由表(按进程显示)
```
---
## 三、MPLS/LDP相关命令
### 3.1 MPLS转发
```bash
show mpls forwarding-table # MPLS标签转发表
show mpls forwarding-table <next-hop-ip> # 特定下一跳的标签转发表
```
### 3.2 LDP会话和绑定
```bash
show mpls ldp neighbor brief instance <id> # LDP邻居简要信息(必须指定instance!)
show mpls ldp neighbor instance <id> # LDP邻居详细信息
show mpls ldp parameters instance <id> # LDP参数配置
show mpls ldp binding instance <id> # LDP标签绑定信息(全局)
show mpls ldp discovery instance <id> # LDP发现信息
```
### 3.3 LDP配置
```bash
show running-config ldp # LDP运行配置
```
---
## 四、VRF相关命令
### 4.1 VRF路由
```bash
show ip forwarding route vrf <vrf-name> # VRF路由表
show ip route vpn # 查看所有VPN路由
```
### 4.2 VRF业务测试
```bash
ping vrf <vrf-name> <dest-ip> # Ping测VRF内地址
```
---
## 五、隧道相关命令
```bash
# 暂无已验证的隧道查询命令
```
---
## 六、接口和路由基础命令
### 6.1 接口状态
```bash
show interface brief # 接口简要信息
show ip interface brief # IP接口简要信息
```
### 6.2 全局路由
```bash
show ip forwarding route # 全局IPv4路由表
```
### 6.3 ARP/MAC
```bash
show arp # ARP表
```
---
## 七、系统基础命令
### 7.1 系统信息
```bash
show version # 版本信息
show running-config # 当前运行配置
```
---
## 八、快速排障组合
### 8.1 BGP跨域故障(已验证组合)
```bash
# 第零层:业务测试
ping vrf test 4.1.1.1 # 1. Ping测业务连通性
# 第一层:VRF路由检查
show ip forwarding route vrf test # 2. 检查VRF路由表
# 第二层:MPLS标签检查
show mpls forwarding-table <next-hop> # 3. 检查MPLS标签转发表
show mpls forwarding-table <specific-ip> # 4. 检查特定目的地的标签
# 第三层:LDP会话检查
show mpls ldp neighbor brief instance 1 # 5. 检查LDP邻居状态
show mpls ldp neighbor instance 1 # 6. 检查LDP邻居详细信息
show mpls ldp binding instance 1 # 7. 检查LDP标签绑定
show mpls ldp parameters instance 1 # 8. 检查LDP参数配置
show mpls ldp discovery instance 1 # 9. 检查LDP发现信息
# 第四层:BGP路由检查
show bgp vpnv4 unicast vrf test route # 10. 检查BGP VPNv4路由
show bgp vpnv4 unicast summary # 11. 检查BGP VPNv4摘要
show bgp ipv4 unicast summary # 12. 检查BGP IPv4摘要
show bgp ipv4 unicast neighbor # 13. 检查BGP IPv4邻居
# 第五层:IGP邻接检查
show ip ospf neighbor # 14. 检查OSPF邻居
show isis adjacency # 15. 检查IS-IS邻接
show ip ospf interface brief # 16. 检查OSPF接口状态
show isis database # 17. 检查IS-IS数据库
show isis circuit # 18. 检查IS-IS电路
# 第六层:基础路由检查
show ip forwarding route # 19. 检查全局路由表
show ip interface brief # 20. 检查IP接口状态
show arp # 21. 检查ARP表
```
### 8.2 OSPF详细排障
```bash
show ip ospf # OSPF进程总览
show ip ospf interface # OSPF接口详细信息
show ip ospf database # OSPF LSDB
show ip ospf database router-link # OSPF Type-1 LSA(Router LSA)
show ip ospf database network # OSPF Type-2 LSA(Network LSA)
show ip ospf database summary # OSPF Type-3 LSA(Summary LSA)
show ip ospf database asbr # OSPF Type-4 LSA(ASBR Summary LSA)
show ip ospf database external # OSPF Type-5 LSA(External LSA)
show ip ospf database nssa # OSPF Type-7 LSA(NSSA External LSA)
show ip ospf database self-originate # OSPF自生成LSA
show ip ospf border-routers # OSPF边界路由器
show ip ospf virtual-links # OSPF虚链路
show ip ospf route # OSPF路由表(按进程显示)
```
### 8.3 IS-IS详细排障
```bash
show isis adjacency # IS-IS邻接
show isis database # IS-IS LSDB
show isis hostname # IS-IS动态主机名映射
show isis circuit # IS-IS电路信息
```
### 8.4 LDP详细排障
```bash
show mpls ldp neighbor brief instance <id> # LDP邻居简要信息
show mpls ldp neighbor instance <id> # LDP邻居详细信息
show mpls ldp parameters instance <id> # LDP参数配置
show mpls ldp binding instance <id> # LDP标签绑定
show mpls ldp discovery instance <id> # LDP发现信息
```
---
## 九、命令语法说明
### 9.1 重要注意事项
1. **LDP命令必须指定instance**:`show mpls ldp neighbor brief instance <id>` ✅
- `show mpls ldp neighbor brief` ❌ Incomplete command
2. **BGP VPNv4路由查询**:`show bgp vpnv4 unicast vrf <vrf-name> route` ✅
- `show bgp vpnv4 unicast rd-by-vrf <vrf-name>` ❌ Incomplete command
- `show bgp ipv4 unicast route` ❌ Ambiguous command
3. **VRF路由查询**:`show ip forwarding route vrf <vrf-name>` ✅
- `show ip route vrf <vrf-name>` ❌ Invalid input
- `show ipv4 route vrf <vrf-name>` ❌ Invalid input
### 9.2 特殊字符限制
netx平台限制了管道符等特殊字符的使用,建议分步执行命令。
---
**文档维护**:
- 最后更新:2026-07-20
- 验证设备:MER1 @ 10.229.234.136
- 关联文档:`命令探索方法论.md`、`BGP跨域排障命令速查.md`