mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 00:40:45 +08:00
4.2 KiB
4.2 KiB
命令探索方法论:使用 ? 在线帮助
核心价值
在网络运维中,通过设备内置的 ? 帮助系统逐层探索命令,比记忆命令更可靠。
适用场景:
- 文档过时或版本不匹配
- 记不清完整命令路径
- 不同厂商命令差异
- 特定模式下可用命令
五步探索法
Step 1: 定方向 - 从顶层开始
MER1#show ?
列出所有 show 开头的命令类别。
Step 2: 剥洋葱 - 逐层深入
MER1#show bgp ? # BGP相关地址族
MER1#show bgp vpnv4 ? # VPNv4的单播/组播
MER1#show bgp vpnv4 unicast ? # 可用的操作符和参数
Step 3: 看提示 - 理解元符号
关键输出中的特殊标记:
<cr>- 可直接回车执行(命令已完整)A.B.C.D- IPv4地址占位符X:X::X:X- IPv6地址占位符WORD- 任意字符串(如VRF名、邻居IP)<0-32>- 数字范围|- 管道符,用于过滤输出
Step 4: 试执行 - 验证命令
看到 <cr> 提示时,说明命令已完整:
MER1#show bgp vpnv4 unicast vrf test route
Step 5: 记笔记 - 记录成功路径
将验证通过的命令记录下来,形成自己的知识库。
实战案例
案例1:BGP VPNv4路由查询
# 7层探索路径
show bgp ? # ipv4, vpnv4, evpn...
-> show bgp vpnv4 ? # unicast, multicast...
-> show bgp vpnv4 unicast ? # neighbor, network, rd, vrf...
-> show bgp vpnv4 unicast vrf ? # VRF实例名
-> show bgp vpnv4 unicast vrf test ? # detail, in, route...
-> show bgp vpnv4 unicast vrf test route # 执行
案例2:MPLS LDP邻居查询
show mpls ldp ? # backoff, bindings, discovery, neighbor...
-> show mpls ldp neighbor ? # brief, detail, instance...
-> show mpls ldp neighbor brief instance ? # <1-65535>
-> show mpls ldp neighbor brief instance 1 # 执行
案例3:VRF环境下的Ping
ping ? # A.B.C.D, vrf, mpls...
-> ping vrf ? # VRF实例名
-> ping vrf test ? # A.B.C.D, domain
-> ping vrf test 4.1.1.1 # 执行
高级技巧
技巧1:组合管道符过滤
show bgp vpnv4 unicast vrf test route | include 4.1.1
show bgp ipv4 unicast summary | begin Neighbor
技巧2:配置模式同样适用
MER1(config)#router bgp 100
MER1(config-bgp-router)#neighbor ?
MER1(config-bgp-router)#neighbor 10.26.63.152 ?
技巧3:识别命令缩写
sh ? # show的合法缩写
forw ? # forwarding的合法缩写
conf t # configure terminal的缩写
技巧4:区分错误类型
# Incomplete command - 命令不完整,继续用?探索
%Error 140305: Incomplete command.
# Unrecognized command - 走错路了,退回上一层
%Error: Unrecognized command.
常见命令树深度对比
| 功能 | ZTE (ZXROS) | 深度 |
|---|---|---|
| BGP VPNv4路由 | show bgp vpnv4 unicast vrf <name> route |
7层 |
| MPLS LDP邻居 | show mpls ldp neighbor brief instance <id> |
6层 |
| ISIS邻接 | show isis adjacency |
3层 |
| Ping VRF | ping vrf <name> <ip> |
4层 |
快速参考卡片
# 通用模板
<command> ? # 查看下一级
<command> <subcommand> ? # 继续深入
...
<full-command> <cr> # 执行
# 元符号速查
<cr> - 直接回车执行
WORD - 任意字符串
A.B.C.D - IPv4地址
X:X::X:X - IPv6地址
<1-65535> - 数字范围
| - 管道符(begin/include/exclude/count)
> - 重定向到文件
练习任务
用 ? 方法探索以下命令:
- 查看ISIS邻接关系
- 查看OSPF邻居详细信息
- 查看VRF IP_RAN的路由表
- 查看MPLS标签绑定信息
- 查看BGP从邻居10.26.63.152收到的路由
参考答案:
show isis adjacency
show ip ospf neighbor detail
show ip forwarding route vrf IP_RAN
show mpls ldp bindings
show bgp vpnv4 unicast vrf test received 10.26.63.152
终极心法:不要怕敲错,? 永远不会嘲笑你。每个网络专家都是从不停地敲 ? 开始的。
文档版本:v2.0(精简版)
最后更新:2026-07-29